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