Fix GlideImagesPlugin.create(Context) factory method

This commit is contained in:
Dimitry Ivanov 2020-06-09 13:36:07 +03:00
parent dfa21f68e2
commit 7f6d85e1fb
2 changed files with 9 additions and 14 deletions

View File

@ -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`)

View File

@ -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<Drawable> 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