restore current tab
This commit is contained in:
parent
070e5637cc
commit
ddebe1b3c0
|
@ -338,7 +338,11 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateTo(int i) {
|
private void navigateTo(int i) {
|
||||||
pager.setCurrentItem(i);
|
navigateTo(i, !GlobalUserPreferences.reduceMotion);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void navigateTo(int i, boolean smooth) {
|
||||||
|
pager.setCurrentItem(i, smooth);
|
||||||
updateSwitcherIcon(i);
|
updateSwitcherIcon(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +488,19 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewStateRestored(Bundle savedInstanceState) {
|
||||||
|
super.onViewStateRestored(savedInstanceState);
|
||||||
|
if (savedInstanceState == null) return;
|
||||||
|
navigateTo(savedInstanceState.getInt("selectedTab"), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putInt("selectedTab", pager.getCurrentItem());
|
||||||
|
}
|
||||||
|
|
||||||
private class HomePagerAdapter extends RecyclerView.Adapter<SimpleViewHolder> {
|
private class HomePagerAdapter extends RecyclerView.Adapter<SimpleViewHolder> {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue