我想知道是否可以让Glide
使用我在Application类
中注册和创建的相同OkHttpClient
?
因为我们有一个相当复杂的OkHttpClient
,它被我们的服务层所使用,我们希望使用它来替代Glide自己的。
是否可以将其注册为自定义模块呢?
OkHttp version: 2.5.0
Glide version: 3.6.1
我想知道是否可以让Glide
使用我在Application类
中注册和创建的相同OkHttpClient
?
因为我们有一个相当复杂的OkHttpClient
,它被我们的服务层所使用,我们希望使用它来替代Glide自己的。
是否可以将其注册为自定义模块呢?
OkHttp version: 2.5.0
Glide version: 3.6.1
private void setupPicasso()
{
final Picasso picasso = new Picasso.Builder(getApplicationContext())
.downloader(new OkHttpDownloader(getPrimaryHttpClient()))
.build();
Picasso.setSingletonInstance(picasso);
}
Gradle 导入:
compile 'com.squareup.picasso:picasso:2.5.2'
现在使用了正确的客户端,图片也按预期工作。
我希望这能对任何人有所帮助。