Created
August 21, 2019 11:04
-
-
Save vincent-paing/5c684aa46f5e41886e3c7af603418ec3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun ImageView.loadWithDefault( | |
url: String?, | |
imageLoader: ImageLoader = Coil.loader(), | |
builder: LoadRequestBuilder.() -> Unit = {} | |
): RequestDisposable { | |
val loadRequestBuilder = LoadRequestBuilder( | |
this.context, LoadRequest( | |
this.context, | |
defaults = DefaultRequestOptions() | |
) | |
) | |
.data(url) | |
.target(this@loadWithDefault) | |
.apply(builder) | |
return imageLoader.load(loadRequestBuilder.build()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment