Skip to content

Instantly share code, notes, and snippets.

View kinsleykajiva's full-sized avatar
🏠
Working from home

Kinsley Kajiva kinsleykajiva

🏠
Working from home
  • Africa
  • 02:06 (UTC +02:00)
View GitHub Profile
@kinsleykajiva
kinsleykajiva / OkHttpProgressGlideModule.java
Created January 21, 2017 10:58 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}