Импортируйте последние Glide
зависимости в файл оценки.
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
Затем используйте одно из следующих решений:
Glide.with(thisActivity)
.asGif()
.load(R.raw.logo_gif_motion_low)
.listener(object : RequestListener<GifDrawable> {
override fun onResourceReady(resource: GifDrawable?, model: Any?, target: Target<GifDrawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
// TODO: Process your gif drawable here
return false
}
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<GifDrawable>?, isFirstResource: Boolean): Boolean {
return false
}
}).into(splashscreen)
или
Glide.with(thisActivity)
.load(R.raw.logo_gif_motion_low)
.listener(object : RequestListener<Drawable> {
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
val gifDrawable = resource as GifDrawable?
gifDrawable?.let {
// TODO: Process your gif drawable here
}
return false
}
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
return false
}
})
.into(splashscreen)