glide-transformations
glide-transformations copied to clipboard
How to transform a gif drawable by loading resource
Today, when I ran the sample and tested the effect of gif, I found that when I load the id of a Gif resource, the transform is in effect. If I load a gif resource, the transform does not take effect.
library version
versions.glide = "4.9.0"
versions.glideTransformations = "4.0.1"
versions.glideCompiler = "4.9.0"
versions.gpuImage = "2.0.3"
code show
val gifDrawable = ContextCompat.getDrawable(context, R.drawable.test)
var context = Utils.isValidContextForGlide(holder.image)
if (context != null) {
Glide.with(holder.image.context)
.asDrawable()
// .load(gifDrawable) does not take effect.
.load(R.drawable.test) // in effect
.apply(bitmapTransform(MultiTransformation<Bitmap>(CenterCrop(), MaskTransformation(R.drawable.mask_starfish))))
.into(holder.image)
}
If I use
.load(gifDrawable)
there is no effect! So I would like to ask the reason, is it my own improper use?
OS detail
- Huawei Honor Magic 2
- Android 9