mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-01 13:57:10 +01:00
Animate layout changes in item_post_compact.xml.
This commit is contained in:
parent
428734bdde
commit
b47422fd75
@ -16,6 +16,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -782,9 +783,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mCompactLayoutToolbarHiddenByDefault) {
|
if (mCompactLayoutToolbarHiddenByDefault) {
|
||||||
((PostCompactBaseViewHolder) holder).bottomConstraintLayout.setVisibility(View.GONE);
|
mCallback.delayTransition();
|
||||||
|
ViewGroup.LayoutParams params = (LinearLayout.LayoutParams) ((PostCompactBaseViewHolder) holder).bottomConstraintLayout.getLayoutParams();
|
||||||
|
params.height = 0;
|
||||||
|
((PostCompactBaseViewHolder) holder).bottomConstraintLayout.setLayoutParams(params);
|
||||||
} else {
|
} else {
|
||||||
((PostCompactBaseViewHolder) holder).bottomConstraintLayout.setVisibility(View.VISIBLE);
|
ViewGroup.LayoutParams params = (LinearLayout.LayoutParams) ((PostCompactBaseViewHolder) holder).bottomConstraintLayout.getLayoutParams();
|
||||||
|
params.height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||||
|
((PostCompactBaseViewHolder) holder).bottomConstraintLayout.setLayoutParams(params);
|
||||||
|
mCallback.delayTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mShowDividerInCompactLayout) {
|
if (mShowDividerInCompactLayout) {
|
||||||
@ -1319,6 +1326,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
void typeChipClicked(int filter);
|
void typeChipClicked(int filter);
|
||||||
|
|
||||||
void currentlyBindItem(int position);
|
void currentlyBindItem(int position);
|
||||||
|
|
||||||
|
void delayTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PostBaseViewHolder extends RecyclerView.ViewHolder {
|
public class PostBaseViewHolder extends RecyclerView.ViewHolder {
|
||||||
@ -2819,10 +2828,16 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
|
|
||||||
itemView.setOnLongClickListener(view -> {
|
itemView.setOnLongClickListener(view -> {
|
||||||
if (mLongPressToHideToolbarInCompactLayout) {
|
if (mLongPressToHideToolbarInCompactLayout) {
|
||||||
if (bottomConstraintLayout.getVisibility() == View.VISIBLE) {
|
if (bottomConstraintLayout.getLayoutParams().height == 0) {
|
||||||
bottomConstraintLayout.setVisibility(View.GONE);
|
ViewGroup.LayoutParams params = (LinearLayout.LayoutParams) bottomConstraintLayout.getLayoutParams();
|
||||||
|
params.height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||||
|
bottomConstraintLayout.setLayoutParams(params);
|
||||||
|
mCallback.delayTransition();
|
||||||
} else {
|
} else {
|
||||||
bottomConstraintLayout.setVisibility(View.VISIBLE);
|
mCallback.delayTransition();
|
||||||
|
ViewGroup.LayoutParams params = (LinearLayout.LayoutParams) bottomConstraintLayout.getLayoutParams();
|
||||||
|
params.height = 0;
|
||||||
|
bottomConstraintLayout.setLayoutParams(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -42,6 +42,8 @@ import androidx.recyclerview.widget.LinearSmoothScroller;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import androidx.transition.AutoTransition;
|
||||||
|
import androidx.transition.TransitionManager;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.RequestManager;
|
import com.bumptech.glide.RequestManager;
|
||||||
@ -441,6 +443,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
maxPosition = position;
|
maxPosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delayTransition() {
|
||||||
|
TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
||||||
@ -488,6 +495,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
maxPosition = position;
|
maxPosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delayTransition() {
|
||||||
|
TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
||||||
@ -537,6 +549,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
maxPosition = position;
|
maxPosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delayTransition() {
|
||||||
|
TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
||||||
@ -585,6 +602,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
maxPosition = position;
|
maxPosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delayTransition() {
|
||||||
|
TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken,
|
||||||
@ -624,6 +646,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
maxPosition = position;
|
maxPosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delayTransition() {
|
||||||
|
TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(mOauthRetrofit, accessToken,
|
mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(mOauthRetrofit, accessToken,
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user