From 29ebfebfd89cd7d7f656585b1e89d42235ee146c Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Tue, 26 Mar 2019 13:16:48 +0300 Subject: [PATCH] Add AsyncDrawableLoader.Builder#implementation method --- gradle.properties | 2 +- .../markwon/image/AsyncDrawableLoader.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 99e26be7..0361db47 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.configureondemand=true android.enableBuildCache=true android.buildCacheDir=build/pre-dex-cache -VERSION_NAME=3.0.0 +VERSION_NAME=3.0.1-SNAPSHOT GROUP=ru.noties.markwon POM_DESCRIPTION=Markwon markdown for Android diff --git a/markwon-core/src/main/java/ru/noties/markwon/image/AsyncDrawableLoader.java b/markwon-core/src/main/java/ru/noties/markwon/image/AsyncDrawableLoader.java index fe6506ee..5eadbe93 100644 --- a/markwon-core/src/main/java/ru/noties/markwon/image/AsyncDrawableLoader.java +++ b/markwon-core/src/main/java/ru/noties/markwon/image/AsyncDrawableLoader.java @@ -53,6 +53,8 @@ public abstract class AsyncDrawableLoader { DrawableProvider placeholderDrawableProvider; DrawableProvider errorDrawableProvider; + AsyncDrawableLoader implementation; + @NonNull public Builder executorService(@NonNull ExecutorService executorService) { this.executorService = executorService; @@ -123,9 +125,29 @@ public abstract class AsyncDrawableLoader { return this; } + /** + * Please note that if implementation is supplied, all configuration properties + * (scheme-handlers, media-decoders, placeholder, etc) of this builder instance + * will be ignored. + * + * @param implementation {@link AsyncDrawableLoader} implementation to be used. + * @since 3.0.1-SNAPSHOT + */ + @NonNull + public Builder implementation(@NonNull AsyncDrawableLoader implementation) { + this.implementation = implementation; + return this; + } + @NonNull public AsyncDrawableLoader build() { + // NB, all other configuration properties will be ignored if + // implementation is specified + if (implementation != null) { + return implementation; + } + // if we have no schemeHandlers -> we cannot show anything // OR if we have no media decoders if (schemeHandlers.size() == 0