diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a2e0856..92dc20de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,15 @@ #### Changed * `html` - `SimpleTagHandler` visits children tags if supplied tag is block one ([#235]) +#### Fixed +* `image-glide` cache `RequestManager` in `GlideImagesPlugin#create(Context)` factory method ([#259]) + #### Deprecated * `core` - `MovementMethodPlugin.create()` use explicit `MovementMethodPlugin.link()` instead [#235]: https://github.com/noties/Markwon/issues/235 +[#259]: https://github.com/noties/Markwon/issues/259 + # 4.4.0 * `TextViewSpan` to obtain `TextView` in which markdown is displayed (applied by `CorePlugin`) diff --git a/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java b/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java index e690c014..657229ec 100644 --- a/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java +++ b/markwon-image-glide/src/main/java/io/noties/markwon/image/glide/GlideImagesPlugin.java @@ -44,20 +44,10 @@ public class GlideImagesPlugin extends AbstractMarkwonPlugin { @NonNull public static GlideImagesPlugin create(@NonNull final Context context) { - return create(new GlideStore() { - @NonNull - @Override - public RequestBuilder load(@NonNull AsyncDrawable drawable) { - return Glide.with(context) - .load(drawable.getDestination()); - } - - @Override - public void cancel(@NonNull Target target) { - Glide.with(context) - .clear(target); - } - }); + // @since $nap; cache RequestManager + // sometimes `cancel` would be called after activity is destroyed, + // so `Glide.with(context)` will throw an exception + return create(Glide.with(context)); } @NonNull