Add AsyncDrawableLoader.Builder#implementation method

This commit is contained in:
Dimitry Ivanov 2019-03-26 13:16:48 +03:00
parent 8a3cdfff04
commit 29ebfebfd8
2 changed files with 23 additions and 1 deletions

View File

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

View File

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