From 5924c921cfb1ed39b6cac5a101a85f7c4d08e1f5 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 19 Jul 2021 20:28:12 +0800 Subject: Fix sometimes images in a Reddit Gallery cannot be loaded. --- .../fragments/ViewRedditGalleryImageOrGifFragment.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java index 476cfc8b..e3e06399 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java @@ -384,9 +384,22 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { activity = (ViewRedditGalleryActivity) context; } + @Override + public void onResume() { + super.onResume(); + SubsamplingScaleImageView ssiv = imageView.getSSIV(); + if (ssiv == null || !ssiv.hasImage()) { + imageView.showImage(Uri.parse(media.url)); + } + } + @Override public void onDestroyView() { super.onDestroyView(); BigImageViewer.imageLoader().cancelAll(); + SubsamplingScaleImageView subsamplingScaleImageView = imageView.getSSIV(); + if (subsamplingScaleImageView != null) { + subsamplingScaleImageView.recycle(); + } } } -- cgit v1.2.3