Because we do not use a SmoothScroller we do not need to keep track of smooth scrolling

This commit is contained in:
martinsandfuchs 2019-12-08 15:01:29 +01:00
parent 027cbdb7a3
commit 9a8a549d69

View File

@ -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,13 +286,11 @@ 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();
}
}
}
});