From 3ce5664aea6a6c14580e3a56bd0cf9e40b04f46c Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 19 Jul 2021 19:55:22 +0800 Subject: Clear ImageView in onDestroyView in ViewRedditGalleryImageOrGifFragment and ViewImgurImageFragment. --- .../infinityforreddit/activities/ViewImgurMediaActivity.java | 1 + .../infinityforreddit/activities/ViewRedditGalleryActivity.java | 1 + .../infinityforreddit/fragments/ViewImgurImageFragment.java | 6 ++++++ .../fragments/ViewRedditGalleryImageOrGifFragment.java | 4 ++-- 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java index c16cef7d..aee7b0fd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java @@ -273,6 +273,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa } }); viewPager.setAdapter(sectionsPagerAdapter); + viewPager.setOffscreenPageLimit(3); } private void setToolbarTitle(int position) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java index 267bd56b..52a02e44 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java @@ -128,6 +128,7 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA } }); viewPager.setAdapter(sectionsPagerAdapter); + viewPager.setOffscreenPageLimit(3); } private void setToolbarTitle(int position) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java index 973b0cee..d4d8c877 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java @@ -269,4 +269,10 @@ public class ViewImgurImageFragment extends Fragment { super.onAttach(context); activity = (ViewImgurMediaActivity) context; } + + @Override + public void onDestroyView() { + super.onDestroyView(); + glide.clear(imageView); + } } 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 89a99a39..476cfc8b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java @@ -385,8 +385,8 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { } @Override - public void onDestroy() { - super.onDestroy(); + public void onDestroyView() { + super.onDestroyView(); BigImageViewer.imageLoader().cancelAll(); } } -- cgit v1.2.3