aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2022-11-13 06:00:37 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2022-11-13 06:00:37 +0000
commit2eaf8a8a01d69d0624b39b22460fedc5497ebfaf (patch)
treec86c1498ca104b162ec7290c2a408aa38596c94a
parent2d62332e8dd4aa1d58cefaa3f6d2fb44d2da5721 (diff)
downloadinfinity-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.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java7
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) {