From d8a5c4dc5272771b90fef96ecc9a7fec112c988d Mon Sep 17 00:00:00 2001 From: Hannes Johansson Date: Wed, 11 Aug 2021 00:32:04 +0200 Subject: [PATCH] Clear cover target when setting folder image To prevent race conditions from recycled views in GridView --- .../main/java/de/danoeh/antennapod/adapter/CoverLoader.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java b/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java index aeaf526be..5d7593564 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java @@ -72,7 +72,10 @@ public class CoverLoader { } public void load() { + CoverTarget coverTarget = new CoverTarget(txtvPlaceholder, imgvCover, textAndImageCombined); + if (resource != 0) { + Glide.with(activity).clear(coverTarget); imgvCover.setImageResource(resource); CoverTarget.setPlaceholderVisibility(txtvPlaceholder, textAndImageCombined); return; @@ -93,7 +96,7 @@ public class CoverLoader { .apply(options)); } - builder.into(new CoverTarget(txtvPlaceholder, imgvCover, textAndImageCombined)); + builder.into(coverTarget); } static class CoverTarget extends CustomViewTarget {