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.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true));
|
||||||
mSwipeRefreshLayout.setOnRefreshListener(this::refresh);
|
mSwipeRefreshLayout.setOnRefreshListener(this::refresh);
|
||||||
|
|
||||||
|
int recyclerViewPosition = 0;
|
||||||
int hideReadPostsIndex = 0;
|
int hideReadPostsIndex = 0;
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
int recyclerViewPosition = savedInstanceState.getInt(RECYCLER_VIEW_POSITION_STATE);
|
recyclerViewPosition = savedInstanceState.getInt(RECYCLER_VIEW_POSITION_STATE);
|
||||||
if (recyclerViewPosition > 0) {
|
|
||||||
mPostRecyclerView.scrollToPosition(recyclerViewPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
||||||
readPosts = savedInstanceState.getParcelableArrayList(READ_POST_LIST_STATE);
|
readPosts = savedInstanceState.getParcelableArrayList(READ_POST_LIST_STATE);
|
||||||
@ -855,6 +853,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
windowWidth /= 2;
|
windowWidth /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recyclerViewPosition > 0) {
|
||||||
|
mPostRecyclerView.scrollToPosition(recyclerViewPosition);
|
||||||
|
}
|
||||||
|
|
||||||
mAdapter.setHideReadPostsIndex(hideReadPostsIndex);
|
mAdapter.setHideReadPostsIndex(hideReadPostsIndex);
|
||||||
|
|
||||||
if (activity instanceof ActivityToolbarInterface) {
|
if (activity instanceof ActivityToolbarInterface) {
|
||||||
|
Loading…
Reference in New Issue
Block a user