Glide

Glide Webp animate support

github repo : https://github.com/roths/GlideWebpSupport

sample code:

val options = RequestOptions()
                .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).diskCacheStrategy(DiskCacheStrategy.NONE)
// webp support
val decoder = WebpResourceDecoder(this)
val byteDecoder = WebpByteBufferDecoder(this)
// use prepend() avoid intercept by default decoder
Glide.get(this.application).registry
    .prepend(InputStream::class.java, WebpDrawable::class.java, decoder)
    .prepend(ByteBuffer::class.java, WebpDrawable::class.java, byteDecoder)
Glide.with(imageView).load("file:///android_asset/sticker.webp")
        .apply(options)
        .transition(DrawableTransitionOptions().crossFade(200))
        .into(imageView)

neeed add below dependencies:

    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation "com.facebook.fresco:animated-webp:1.9.0"
    implementation 'com.facebook.soloader:soloader:0.4.0'
    implementation 'com.facebook.fresco:animated-base-support:0.13.0'
    implementation 'com.facebook.fresco:webpsupport:1.9.0'
comments powered by Disqus