Glide.with(this)
.load(R.drawable.ic_splash_icon_anim)
.addListener(object : RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
if (resource is WebpDrawable) {
resource.loopCount = 1
resource.registerAnimationCallback(object :
Animatable2Compat.AnimationCallback() {
override fun onAnimationEnd(drawable: Drawable?) {
resource.unregisterAnimationCallback(this)
}
})
}
return false
}
})
.into(it.ivImage)
网友评论