mirror of https://github.com/readrops/Readrops.git
Use project level okhttp client with glide
This commit is contained in:
parent
6c6653e443
commit
d59e38ee9d
|
@ -1,10 +0,0 @@
|
|||
package com.readrops.app.utils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.module.AppGlideModule;
|
||||
|
||||
@com.bumptech.glide.annotation.GlideModule
|
||||
public class GlideModule extends AppGlideModule {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.readrops.app.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.Registry
|
||||
import com.bumptech.glide.annotation.GlideModule
|
||||
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.module.AppGlideModule
|
||||
import com.readrops.api.utils.HttpManager
|
||||
import java.io.InputStream
|
||||
|
||||
@GlideModule
|
||||
class ReadropsGlideModule : AppGlideModule() {
|
||||
|
||||
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
|
||||
val factory = OkHttpUrlLoader.Factory(HttpManager.getInstance().okHttpClient)
|
||||
|
||||
glide.registry.replace(GlideUrl::class.java, InputStream::class.java, factory)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue