Browse Source

restore slider position on resume

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
bf1a05a38c
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 3
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

3
app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

@ -294,7 +294,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
return; return;
} }
final Media media = (Media) feedModelSerializable; 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); sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0);
} }
viewModel.setMedia(media); viewModel.setMedia(media);
@ -1039,6 +1039,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
final String text = "1/" + carouselMedia.size(); final String text = "1/" + carouselMedia.size();
binding.mediaCounter.setText(text); binding.mediaCounter.setText(text);
sliderItemsAdapter.submitList(media.getCarouselMedia()); sliderItemsAdapter.submitList(media.getCarouselMedia());
sliderParent.setCurrentItem(sliderPosition);
} }
private void pauseSliderPlayer() { private void pauseSliderPlayer() {

Loading…
Cancel
Save