diff options
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java index e0350c63..1c4b8c04 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java @@ -169,14 +169,14 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA haulerView.setDragEnabled(false); } - setupViewPager(); + setupViewPager(savedInstanceState); } public boolean isUseBottomAppBar() { return useBottomAppBar; } - private void setupViewPager() { + private void setupViewPager(Bundle savedInstanceState) { if (!useBottomAppBar) { setToolbarTitle(0); viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @@ -189,6 +189,9 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(sectionsPagerAdapter); viewPager.setOffscreenPageLimit(3); + if (savedInstanceState == null) { + viewPager.setCurrentItem(getIntent().getIntExtra(EXTRA_GALLERY_ITEM_INDEX, 0), false); + } } private void setToolbarTitle(int position) { |