Skip to content

Instantly share code, notes, and snippets.

@babedev
Created April 19, 2017 08:16
Show Gist options
  • Save babedev/f45ca0b56d2da0239b3f0d0dd4c74c8a to your computer and use it in GitHub Desktop.
Save babedev/f45ca0b56d2da0239b3f0d0dd4c74c8a to your computer and use it in GitHub Desktop.
ImageView extension for show image with Glide
fun ImageView.show(imageUrl: String = "") {
if (context == null) return
if (context is Activity && ((context as Activity).isFinishing || (context as Activity).isDestroyed)) return
Glide.with(context)
.load(imageUrl)
.crossFade()
.signature(StringSignature(UUID.randomUUID().toString()))
.into(this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment