diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java index effb0cf2e..d95d6fd23 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java @@ -338,7 +338,11 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab } 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); } @@ -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 { @NonNull @Override