|
|
|
@ -16,21 +16,26 @@ import okhttp3.OkHttpClient; |
|
|
|
|
|
|
|
|
|
public class ProgressGlideModule extends AppGlideModule { |
|
|
|
|
|
|
|
|
|
//配置glide网络加载框架
|
|
|
|
|
@Override |
|
|
|
|
@CallSuper |
|
|
|
|
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { |
|
|
|
|
//配置glide网络加载框架
|
|
|
|
|
ProgressManager.getInstance().setRefreshTime(getRefreshTime()); |
|
|
|
|
OkHttpClient.Builder builder = ProgressManager.getInstance().withProgress(new OkHttpClient.Builder()); |
|
|
|
|
configImageOkHttp(builder); |
|
|
|
|
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//不使用清单配置的方式,减少初始化时间
|
|
|
|
|
@Override |
|
|
|
|
public boolean isManifestParsingEnabled() { |
|
|
|
|
//不使用清单配置的方式,减少初始化时间
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void configImageOkHttp(OkHttpClient.Builder builder) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected int getRefreshTime() { |
|
|
|
|
return 200; |
|
|
|
|
} |
|
|
|
|