From 9a8a549d69ba3049a58fc31e88b95d6445dd40d0 Mon Sep 17 00:00:00 2001 From: martinsandfuchs Date: Sun, 8 Dec 2019 15:01:29 +0100 Subject: Because we do not use a SmoothScroller we do not need to keep track of smooth scrolling --- .../infinityforreddit/Fragment/PostFragment.java | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java index 2ae04cfa..17661c24 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java @@ -122,7 +122,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private CountDownTimer resumeLazyModeCountDownTimer; private float lazyModeInterval; private int postLayout; - private boolean mIsSmoothScrolling = false; public PostFragment() { // Required empty public constructor @@ -140,7 +139,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } private boolean scrollPostsByCount(int count) { - mIsSmoothScrolling = true; if (mLinearLayoutManager != null) { int pos = mLinearLayoutManager.findFirstVisibleItemPosition(); int targetPosition = pos + count; @@ -188,16 +186,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } }; - mPostRecyclerView.clearOnScrollListeners(); - mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - mIsSmoothScrolling = false; - } - } - }); - window = activity.getWindow(); Resources resources = getResources(); @@ -298,12 +286,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { - if (!mIsSmoothScrolling) { - if (dy > 0) { - ((MainActivity) activity).postScrollDown(); - } else if (dy < 0) { - ((MainActivity) activity).postScrollUp(); - } + if (dy > 0) { + ((MainActivity) activity).postScrollDown(); + } else if (dy < 0) { + ((MainActivity) activity).postScrollUp(); } } -- cgit v1.2.3