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
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » Android Glide load origin Bitmap, Kotlin
发表评论 取消回复