Skip to content

Commit

Permalink
update cache bug
Browse files Browse the repository at this point in the history
  • Loading branch information
open-android committed Dec 16, 2016
1 parent 0fe9e1b commit e6eb7a0
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,20 @@ public static String getBaseUrl() {
}

private HttpHelper() {
//缓存路径
mCacheFile = new File(ItheimaHttp.getContext().getCacheDir().getAbsolutePath() + File.separator + "retrofit2_http_cache");
//判断缓存路径是否存在
if (!mCacheFile.exists() && !mCacheFile.isDirectory()) {
mCacheFile.mkdir();
}

OkHttpClient okHttpClient = createOkhttpAndCache();
mRetrofit = new Retrofit.Builder()
.baseUrl(sBaseUrl)
.client(okHttpClient)
.addConverterFactory(StringConverterFactory.create())
//.addConverterFactory(GsonConverterFactory.create())
.build();
//缓存路径
mCacheFile = new File(ItheimaHttp.getContext().getCacheDir().getAbsolutePath() + File.separator + "retrofit2_http_cache");
//判断缓存路径是否存在
if (!mCacheFile.exists() && !mCacheFile.isDirectory()) {
mCacheFile.mkdir();
}

}

Expand Down

0 comments on commit e6eb7a0

Please sign in to comment.