提交 4db9ef95 编写于 作者: J jessyan

improve GlideModule

上级 339b7232
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -32,7 +32,7 @@ import retrofit2.converter.gson.GsonConverterFactory; ...@@ -32,7 +32,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
*/ */
@Module @Module
public class ClientModule { public class ClientModule {
private static final int TOME_OUT = 10; private static final int TIME_OUT = 10;
public static final int HTTP_RESPONSE_DISK_CACHE_MAX_SIZE = 10 * 1024 * 1024;//缓存文件最大值为10Mb public static final int HTTP_RESPONSE_DISK_CACHE_MAX_SIZE = 10 * 1024 * 1024;//缓存文件最大值为10Mb
private HttpUrl mApiUrl; private HttpUrl mApiUrl;
private GlobeHttpHandler mHandler; private GlobeHttpHandler mHandler;
...@@ -185,8 +185,8 @@ public class ClientModule { ...@@ -185,8 +185,8 @@ public class ClientModule {
OkHttpClient.Builder builder = okHttpClient OkHttpClient.Builder builder = okHttpClient
.connectTimeout(TOME_OUT, TimeUnit.SECONDS) .connectTimeout(TIME_OUT, TimeUnit.SECONDS)
.readTimeout(TOME_OUT, TimeUnit.SECONDS) .readTimeout(TIME_OUT, TimeUnit.SECONDS)
.cache(cache)//设置缓存 .cache(cache)//设置缓存
.addNetworkInterceptor(intercept); .addNetworkInterceptor(intercept);
if (mInterceptors != null && mInterceptors.length > 0) {//如果外部提供了interceptor的数组则遍历添加 if (mInterceptors != null && mInterceptors.length > 0) {//如果外部提供了interceptor的数组则遍历添加
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册