From bf1a05a38cf649404d5f64d18f68c4985b263049 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 28 Jun 2021 15:29:02 -0400 Subject: [PATCH] restore slider position on resume --- .../java/awais/instagrabber/fragments/PostViewV2Fragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java index 8948b831..dbd53aa3 100644 --- a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java @@ -294,7 +294,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme return; } final Media media = (Media) feedModelSerializable; - if (media.getMediaType() == MediaItemType.MEDIA_TYPE_SLIDER) { + if (media.getMediaType() == MediaItemType.MEDIA_TYPE_SLIDER && sliderPosition == -1) { sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0); } viewModel.setMedia(media); @@ -1039,6 +1039,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme final String text = "1/" + carouselMedia.size(); binding.mediaCounter.setText(text); sliderItemsAdapter.submitList(media.getCarouselMedia()); + sliderParent.setCurrentItem(sliderPosition); } private void pauseSliderPlayer() {