Show correct image in the gallery in ViewRedditGalleryActivity.

This commit is contained in:
Docile-Alligator 2022-11-13 17:00:37 +11:00
parent 2d62332e8d
commit 2eaf8a8a01

View File

@ -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) {