Skip to content

Instantly share code, notes, and snippets.

@jisungbin
Created April 20, 2020 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jisungbin/69b8c6577862cf1e121fa4c76cb88e93 to your computer and use it in GitHub Desktop.
Save jisungbin/69b8c6577862cf1e121fa4c76cb88e93 to your computer and use it in GitHub Desktop.
package com.sungbin.autoreply.bot.three.utils.ui
import android.content.Context
import android.content.res.Resources
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DecodeFormat
import com.bumptech.glide.load.engine.DiskCacheStrategy
object Glide {
fun set(context: Context, content: Drawable, view: ImageView) {
Glide.with(context)
.load(content)
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(true)
.into(view)
}
fun set(context: Context, content: Resources, view: ImageView) {
Glide.with(context)
.load(content)
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(true)
.into(view)
}
fun set(context: Context, content: String, view: ImageView) {
Glide.with(context)
.load(content)
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(true)
.into(view)
}
fun set(context: Context, content: Bitmap, view: ImageView) {
Glide.with(context)
.load(content)
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(true)
.into(view)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment