GlideModule appears to have no effect(?)
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
I tried to follow the guide at `https://bumptech.github.io/glide/tut/custom-modelloader.html` but it isn't working. I don't think the annotation has any effect, Glide doesn't even see my custom module. I just implemented a test at the moment, but none of the log statements are getting logged to the console.
```kt
@GlideModule
class RemoteModule: AppGlideModule() {
override fun registerComponents(ctx: Context, g: Glide, reg: Registry) {
Log.i("test", "RemoteModule Init")
reg.prepend(String::class.java, ParcelFileDescriptor::class.java, RemoteFactory(ctx))
}
}
private class RemoteFactory(val ctx: Context): ModelLoaderFactory {
override fun build(mf: MultiModelLoaderFactory): RemoteLoader {
Log.i("test", "RemoteFactory Init")
return RemoteLoader(ctx)
}
override fun teardown() {}
}
private class RemoteLoader(val ctx: Context): ModelLoader {
override fun handles(path: String): Boolean {
return isRemotePath(path)
}
override fun buildLoadData(path: String, w: Int, h: Int, opts: Options) =
ModelLoader.LoadData(ObjectKey(path), RemoteFetcher(path, ctx))
}
private class RemoteFetcher(val path: String, val ctx: Context): DataFetcher {
private var pfd: ParcelFileDescriptor? = null
override fun loadData(pri: Priority, cb: DataFetcher.DataCallback) {
//TODO Get pfd
cb.onLoadFailed(Exception("Test error"))
}
override fun cancel() {}
override fun cleanup() {pfd?.close()}
override fun getDataClass() = ParcelFileDescriptor::class.java
override fun getDataSource() = DataSource.REMOTE
}
```
In build.gradle.kts:
```kt
dependencies {
implementation("com.github.bumptech.glide:glide:4.16.0")
implementation("com.github.bumptech.glide:annotations:4.16.0")
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
//Other depends...
}
```
Contributor guide
Assessment
This issue has not been assessed yet.