diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2022-11-13 06:00:37 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2022-11-13 06:00:37 +0000 |
commit | 2eaf8a8a01d69d0624b39b22460fedc5497ebfaf (patch) | |
tree | c86c1498ca104b162ec7290c2a408aa38596c94a /app/src | |
parent | 2d62332e8dd4aa1d58cefaa3f6d2fb44d2da5721 (diff) | |
download | infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.tar infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.tar.gz infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.tar.bz2 infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.tar.lz infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.tar.xz infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.tar.zst infinity-for-reddit-2eaf8a8a01d69d0624b39b22460fedc5497ebfaf.zip |
Show correct image in the gallery in ViewRedditGalleryActivity.
Diffstat (limited to '')
-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) { |