Fix Glide leaking reference to activity (#6446)

This commit is contained in:
peking_ling 2023-05-07 17:43:35 +08:00 committed by GitHub
parent b8a1c1f49a
commit c759eed50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -69,7 +69,7 @@ public class CoverLoader {
CoverTarget coverTarget = new CoverTarget(fallbackTitle, imgvCover, textAndImageCombined);
if (resource != 0) {
Glide.with(activity).clear(coverTarget);
Glide.with(imgvCover).clear(coverTarget);
imgvCover.setImageResource(resource);
CoverTarget.setTitleVisibility(fallbackTitle, textAndImageCombined);
return;
@ -79,13 +79,13 @@ public class CoverLoader {
.fitCenter()
.dontAnimate();
RequestBuilder<Drawable> builder = Glide.with(activity)
RequestBuilder<Drawable> builder = Glide.with(imgvCover)
.as(Drawable.class)
.load(uri)
.apply(options);
if (fallbackUri != null) {
builder = builder.error(Glide.with(activity)
builder = builder.error(Glide.with(imgvCover)
.as(Drawable.class)
.load(fallbackUri)
.apply(options));

View File

@ -203,9 +203,9 @@ public class ExternalPlayerFragment extends Fragment {
.fitCenter()
.dontAnimate();
Glide.with(getActivity())
Glide.with(this)
.load(ImageResourceUtils.getEpisodeListImageLocation(media))
.error(Glide.with(getActivity())
.error(Glide.with(this)
.load(ImageResourceUtils.getFallbackImageLocation(media))
.apply(options))
.apply(options)

View File

@ -498,7 +498,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
}
private void loadFeedImage() {
Glide.with(getActivity())
Glide.with(this)
.load(feed.getImageUrl())
.apply(new RequestOptions()
.placeholder(R.color.image_readability_tint)
@ -507,7 +507,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
.dontAnimate())
.into(viewBinding.imgvBackground);
Glide.with(getActivity())
Glide.with(this)
.load(feed.getImageUrl())
.apply(new RequestOptions()
.placeholder(R.color.light_gray)