aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index 19bfaeb5..a1edea83 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -374,12 +374,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mSwipeRefreshLayout.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true));
mSwipeRefreshLayout.setOnRefreshListener(this::refresh);
+ int recyclerViewPosition = 0;
int hideReadPostsIndex = 0;
if (savedInstanceState != null) {
- int recyclerViewPosition = savedInstanceState.getInt(RECYCLER_VIEW_POSITION_STATE);
- if (recyclerViewPosition > 0) {
- mPostRecyclerView.scrollToPosition(recyclerViewPosition);
- }
+ recyclerViewPosition = savedInstanceState.getInt(RECYCLER_VIEW_POSITION_STATE);
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
readPosts = savedInstanceState.getParcelableArrayList(READ_POST_LIST_STATE);
@@ -855,6 +853,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
windowWidth /= 2;
}
+ if (recyclerViewPosition > 0) {
+ mPostRecyclerView.scrollToPosition(recyclerViewPosition);
+ }
+
mAdapter.setHideReadPostsIndex(hideReadPostsIndex);
if (activity instanceof ActivityToolbarInterface) {