mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Fix recyclerview not scroll to correct last place after changing orientation.
This commit is contained in:
parent
bb36cc79fd
commit
fe192131d8
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user