diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-02-19 14:43:33 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-02-19 14:43:33 +0000 |
commit | 97993709e2a2c286583df1cba445a351a7b9d676 (patch) | |
tree | ea9eb7af4b313849e27279374f25ee55d62ac5a2 /app/src/main/java | |
parent | bbc69b45e6f414673906641232cde0f72a641f35 (diff) | |
download | infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.tar infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.tar.gz infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.tar.bz2 infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.tar.lz infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.tar.xz infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.tar.zst infinity-for-reddit-97993709e2a2c286583df1cba445a351a7b9d676.zip |
Hide the fab in ViewPostDetailActivity when the recyclerview is scrolled to the bottom. Fix the fab shows under the nav bar in ViewPostDetailActivity.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java | 94 |
1 files changed, 57 insertions, 37 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 63ebd1ce..a3123182 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -243,7 +243,11 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); if (navBarResourceId > 0) { - mRecyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId)); + int navBarHeight = resources.getDimensionPixelSize(navBarResourceId); + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + params.bottomMargin = navBarHeight; + fab.setLayoutParams(params); + mRecyclerView.setPadding(0, 0, 0, navBarHeight); showToast = true; } } @@ -272,17 +276,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (!mIsSmoothScrolling && !mLockFab) { - if (dy > 0) { - if (mSwipeUpToHideFab) { - fab.show(); - } else { - fab.hide(); - } + if (!recyclerView.canScrollVertically(1)) { + fab.hide(); } else { - if (mSwipeUpToHideFab) { - fab.hide(); + if (dy > 0) { + if (mSwipeUpToHideFab) { + fab.show(); + } else { + fab.hide(); + } } else { - fab.show(); + if (mSwipeUpToHideFab) { + fab.hide(); + } else { + fab.show(); + } } } } @@ -311,17 +319,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (!mIsSmoothScrolling && !mLockFab) { - if (dy > 0) { - if (mSwipeUpToHideFab) { - fab.show(); - } else { - fab.hide(); - } + if (!recyclerView.canScrollVertically(1)) { + fab.hide(); } else { - if (mSwipeUpToHideFab) { - fab.hide(); + if (dy > 0) { + if (mSwipeUpToHideFab) { + fab.show(); + } else { + fab.hide(); + } } else { - fab.show(); + if (mSwipeUpToHideFab) { + fab.hide(); + } else { + fab.show(); + } } } } @@ -657,17 +669,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (!mIsSmoothScrolling && !mLockFab) { - if (dy > 0) { - if (mSwipeUpToHideFab) { - fab.show(); - } else { - fab.hide(); - } + if (!recyclerView.canScrollVertically(1)) { + fab.hide(); } else { - if (mSwipeUpToHideFab) { - fab.hide(); + if (dy > 0) { + if (mSwipeUpToHideFab) { + fab.show(); + } else { + fab.hide(); + } } else { - fab.show(); + if (mSwipeUpToHideFab) { + fab.hide(); + } else { + fab.show(); + } } } } @@ -753,17 +769,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (!mIsSmoothScrolling && !mLockFab) { - if (dy > 0) { - if (mSwipeUpToHideFab) { - fab.show(); - } else { - fab.hide(); - } + if (!recyclerView.canScrollVertically(1)) { + fab.hide(); } else { - if (mSwipeUpToHideFab) { - fab.hide(); + if (dy > 0) { + if (mSwipeUpToHideFab) { + fab.show(); + } else { + fab.hide(); + } } else { - fab.show(); + if (mSwipeUpToHideFab) { + fab.hide(); + } else { + fab.show(); + } } } } |