1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-14 10:47:30 +00:00

restore slider position on resume

This commit is contained in:
Austin Huang 2021-06-28 15:29:02 -04:00
parent 10447cd633
commit bf1a05a38c
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

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