-1
在畢加索,我使用OkHttp來請求網絡。我希望將我的圖像緩存在畢加索。但我也希望在我的OkHttpClient中使用日誌攔截器。畢加索 - OkHttp3Downloader添加日誌截取器
要添加OkHttp的日誌記錄攔截器,我做這種方式:
OkHttpClient provideOkHttpClient() {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(logging);
return httpClient.build();
}
要添加畢加索緩存中,我使用new OkHttp3Downloader(context, Integer.MAX_VALUE)
這樣:
Picasso providePicasso(Context context, OkHttpClient httpClient) {
Picasso.Builder builder = new Picasso.Builder();
builder.downloader(new OkHttp3Downloader(context, Integer.MAX_VALUE));
Picasso built = builder.build();
Picasso.setSingletonInstance(built);
}
我如何可以提供:
一個)高速緩存
b)OkHttpClient
要OkHttp3Downloader
這樣我就可以緩存畢加索的請求,並用OkHttp
登錄畢加索請求?