public class CustomGlideModule extends GlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { // stub }
@Override public void registerComponents(Context context, Glide glide) { final OkHttpClient.Builder builder = new OkHttpClient.Builder();
// set your timeout here builder.readTimeout(30, TimeUnit.SECONDS); builder.writeTimeout(30, TimeUnit.SECONDS); builder.connectTimeout(30, TimeUnit.SECONDS);
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build())); } } <meta-data android:name="{packageName}.CustomGlideModule" android:value="GlideModule" />