aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-06-24 13:49:04 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-06-24 13:49:04 +0000
commit2236305e191cb1879fe5192bb88eace766a43fdb (patch)
treed151df8832f73c2f0120a8eb8cb01ecbbd708094 /app/src/main/java/ml/docilealligator
parent51fd4c3749fee0c3ee345b0aaf3d107a563b5126 (diff)
downloadinfinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.tar
infinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.tar.gz
infinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.tar.bz2
infinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.tar.lz
infinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.tar.xz
infinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.tar.zst
infinity-for-reddit-2236305e191cb1879fe5192bb88eace766a43fdb.zip
Fix delaying transition not working in landscape orientation in ViewPostDetailFragment for comments.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
index f94db669..afa5c5fb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
@@ -260,8 +260,21 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mSavedIcon = getMenuItemIcon(R.drawable.ic_bookmark_toolbar_24dp);
mUnsavedIcon = getMenuItemIcon(R.drawable.ic_bookmark_border_toolbar_24dp);
+ if (getResources().getBoolean(R.bool.isTablet) || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ mLinearLayoutManager = new LinearLayoutManager(activity);
+ mCommentsRecyclerView = rootView.findViewById(R.id.comments_recycler_view_view_post_detail_fragment);
+ mCommentsRecyclerView.setLayoutManager(mLinearLayoutManager);
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
+ } else {
+ mLinearLayoutManager = new LinearLayoutManager(activity);
+ mRecyclerView.setLayoutManager(mLinearLayoutManager);
+ }
+
if (activity != null && activity.isImmersiveInterface()) {
mRecyclerView.setPadding(0, 0, 0, activity.getNavBarHeight() + mRecyclerView.getPaddingBottom());
+ if (mCommentsRecyclerView != null) {
+ mCommentsRecyclerView.setPadding(0, 0, 0, activity.getNavBarHeight() + mCommentsRecyclerView.getPaddingBottom());
+ }
showToast = true;
}
@@ -280,16 +293,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
- if (getResources().getBoolean(R.bool.isTablet) || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
- mLinearLayoutManager = new LinearLayoutManager(activity);
- mCommentsRecyclerView = rootView.findViewById(R.id.comments_recycler_view_view_post_detail_fragment);
- mCommentsRecyclerView.setLayoutManager(mLinearLayoutManager);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
- } else {
- mLinearLayoutManager = new LinearLayoutManager(activity);
- mRecyclerView.setLayoutManager(mLinearLayoutManager);
- }
-
if (children != null && children.size() > 0) {
(mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@@ -1159,7 +1162,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mCommentsAdapter.addComments(expandedComments, hasMoreChildren);
if (children.size() > 0) {
- mRecyclerView.clearOnScrollListeners();
+ (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).clearOnScrollListeners();
(mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
@@ -1297,7 +1300,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mCommentsAdapter.addComments(expandedComments, hasMoreChildren);
if (children.size() > 0) {
- mRecyclerView.clearOnScrollListeners();
+ (mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).clearOnScrollListeners();
(mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView).addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
@@ -1689,7 +1692,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
}
public void delayTransition() {
- TransitionManager.beginDelayedTransition(mRecyclerView, new AutoTransition());
+ TransitionManager.beginDelayedTransition((mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView), new AutoTransition());
}
public void showRemovedPost() {