本文整理了Java中com.squareup.picasso.Picasso.setSingletonInstance()
方法的一些代码示例,展示了Picasso.setSingletonInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Picasso.setSingletonInstance()
方法的具体详情如下:
包路径:com.squareup.picasso.Picasso
类名称:Picasso
方法名:setSingletonInstance
暂无
代码示例来源:origin: alibaba/Tangram-Android
@Override
public void onCreate() {
super.onCreate();
Picasso.setSingletonInstance(new Picasso.Builder(this).loggingEnabled(true).build());
}
}
代码示例来源:origin: alibaba/Tangram-Android
protected void onCreate(Bundle savedInstanceState) {
try {
Picasso.setSingletonInstance(new Picasso.Builder(this).loggingEnabled(true).build());
} catch (Exception e) {
代码示例来源:origin: jaredrummler/AndroidProcesses
@Override public void onCreate() {
super.onCreate();
AndroidProcesses.setLoggingEnabled(true);
Picasso.setSingletonInstance(new Picasso.Builder(this)
.addRequestHandler(new AppIconRequestHandler(this))
.build());
}
代码示例来源:origin: ArturVasilov/AndroidSchool
@Override
public void onCreate() {
super.onCreate();
sInstance = this;
Picasso picasso = new Picasso.Builder(this)
.downloader(new OkHttp3Downloader(this))
.build();
Picasso.setSingletonInstance(picasso);
}
代码示例来源:origin: TUM-Dev/Campus-Android
protected void setupPicasso() {
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttp3Downloader(this, Integer.MAX_VALUE));
Picasso built = builder.build();
built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
}
代码示例来源:origin: cyforever123/ElectronicbrandProject
/**
* 初始化数据
*/
private void initData() {
ebApplication = this;
BridgeFactory.init(this);
BridgeLifeCycleSetKeeper.getInstance().initOnApplicationCreate(this);
LocalFileStorageManager manager = BridgeFactory.getBridge(Bridges.LOCAL_FILE_STORAGE);
Picasso picasso = new Picasso.Builder(this).downloader(
new OkHttpDownloader(new File(manager.getCacheImgFilePath(this)))).build();
Picasso.setSingletonInstance(picasso);
}
代码示例来源:origin: tarek360/PhotoDiscovery
private void initPicasso() {
File cacheDirectory = new File(getCacheDir().getAbsolutePath(), "OKHttpCache");
OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.setCache(new Cache(cacheDirectory, Integer.MAX_VALUE));
/** Dangerous interceptor that rewrites the server's cache-control header. */
okHttpClient.networkInterceptors().add(new Interceptor() {
@Override public Response intercept(Chain chain) throws IOException {
Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.header("Cache-Control", "public, max-age=432000")
.header("Pragma", "")
.build();
}
});
OkHttpDownloader okHttpDownloader = new OkHttpDownloader(okHttpClient);
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(okHttpDownloader);
Picasso picasso = builder.build();
//picasso.setIndicatorsEnabled(true);
//picasso.setLoggingEnabled(true);
Picasso.setSingletonInstance(picasso);
}
代码示例来源:origin: dongorigin/AndroidDemo
public static void init(Context context) {
Picasso picasso = new Picasso.Builder(context)
.downloader(new OkHttp3Downloader(OkHttpHelper.INSTANCE.getOkHttpClient()))
.build();
try {
Picasso.setSingletonInstance(picasso);
} catch (IllegalStateException e) {
Timber.d(e, "");
}
}
}
代码示例来源:origin: akshayejh/Lapit---Android-Firebase-Chat-App
@Override
public void onCreate() {
super.onCreate();
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
/* Picasso */
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttpDownloader(this, Integer.MAX_VALUE));
Picasso built = builder.build();
built.setIndicatorsEnabled(true);
built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
mAuth = FirebaseAuth.getInstance();
if(mAuth.getCurrentUser() != null) {
mUserDatabase = FirebaseDatabase.getInstance()
.getReference().child("Users").child(mAuth.getCurrentUser().getUid());
mUserDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot != null) {
mUserDatabase.child("online").onDisconnect().setValue(ServerValue.TIMESTAMP);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
内容来源于网络,如有侵权,请联系作者删除!