Android Glide load origin Bitmap, Kotlin
Android Glide load origin Bitmap, Kotlin
Glide.with(this)
.asBitmap()
.load(R.mipmap.p)
.addListener(object : RequestListener<Bitmap> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>, isFirstResource: Boolean): Boolean {
return false
}
override fun onResourceReady(
resource: Bitmap,
model: Any,
target: Target<Bitmap>?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
Log.d("fly", "a ${resource.height} ${resource.width}")
return false
}
})
.preload()
Glide.with(this)
.asBitmap()
.load(R.mipmap.p)
.into(object : CustomTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
Log.d("fly", "b ${resource.height} ${resource.width}")
}
override fun onLoadCleared(placeholder: Drawable?) {
}
})
val target = PreloadTarget.obtain<Bitmap>(Glide.with(this), 150, 250)
Glide.with(this)
.asBitmap()
.load(R.mipmap.p)
.addListener(object : RequestListener<Bitmap> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>, isFirstResource: Boolean): Boolean {
return false
}
override fun onResourceReady(
resource: Bitmap,
model: Any,
target: Target<Bitmap>?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
Log.d("fly", "c ${resource.height} ${resource.width}")
return false
}
})
.into(target)
D a 2414 3697
D b 2414 3697
D c 250 383
原文地址:https://blog.csdn.net/zhangphil/article/details/143904149
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!