After I write a ResourceDecoder to load NinePatchDrawable, which will cause APNG4Android Loaders not work.
My loader returned false will fallback to Glide Default ResourceDecoders but APNG4Android's Decoders。
@GlideModule
class NineGlideModule : LibraryGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
super.registerComponents(context, glide, registry)
registry.prepend(ByteBuffer::class.java, Drawable::class.java, NinePatchResourceDecoder())
}
}
class NinePatchResourceDecoder : ResourceDecoder<ByteBuffer, Drawable> {
/**
* Just a mock ResourceDecoder, won't work, return false
*/
override fun handles(source: ByteBuffer, options: Options) = false
override fun decode(
source: ByteBuffer,
width: Int,
height: Int,
options: Options
): Resource<Drawable>? {
TODO("Not yet implemented")
}
}
I found a solution to fix this issue, exclude the GlideAnimationModule and register it manually, which will promote GlideAnimationModule priority.
@Excludes(GlideAnimationModule::class)
@GlideModule
class MyAppGlideModule : AppGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
super.registerComponents(context, glide, registry)
// Make it the last line with highest priority
GlideAnimationModule().registerComponents(context, glide, registry)
}
}
My question is can you provide another way to fix this issue elegant?
New Issue Checklist
Issue Info
Issue Description and Steps
After I write a
ResourceDecoder
to loadNinePatchDrawable
, which will cause APNG4Android Loaders not work. My loader returnedfalse
will fallback to Glide DefaultResourceDecoder
s but APNG4Android's Decoders。I found a solution to fix this issue, exclude the
GlideAnimationModule
and register it manually, which will promoteGlideAnimationModule
priority.My question is can you provide another way to fix this issue elegant?