本文整理汇总了Java中com.squareup.picasso.Picasso.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java Picasso.Builder方法的具体用法?Java Picasso.Builder怎么用?Java Picasso.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.picasso.Picasso
的用法示例。
在下文中一共展示了Picasso.Builder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if(!FirebaseApp.getApps(this).isEmpty()){
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
}
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttp3Downloader(this, Integer.MAX_VALUE));
Picasso built = builder.build();
built.setIndicatorsEnabled(false);
built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
}
示例2: BookViewHolder
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
public BookViewHolder(View itemView, final ShowDetailsListener showDetailsListener) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.title);
authors = (TextView) itemView.findViewById(R.id.authors);
pages = (TextView) itemView.findViewById(R.id.pages);
picture = (ImageView) itemView.findViewById(R.id.picture);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (book != null) {
showDetailsListener.showDetails(book, picture.getDrawable());
Log.d(TAG, "Image clicked " + title.getText());
}
}
});
Picasso.Builder builder = new Picasso.Builder(picture.getContext());
builder.executor(executors);
picasso = builder.build();
}
示例3: providePicasso
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Provides @Singleton Picasso providePicasso(OkHttpClient client, Application app) {
Picasso.Builder builder = new Picasso.Builder(app).downloader(new OkHttp3Downloader(client));
builder.listener((picasso, uri, exception) -> {
Timber.e(exception, "Error while loading image %s", uri);
});
return builder.build();
}
示例4: onCreate
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// Initialize Picasso configuration
Picasso.Builder builder = new Picasso.Builder(this);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
builder.downloader(new OkHttp3Downloader(OkHttpUtils.getCompatibleClient(preferences)));
if (BuildConfig.DEBUG) {
builder.listener((picasso, uri, exception) -> exception.printStackTrace());
}
try {
Picasso.setSingletonInstance(builder.build());
} catch (IllegalStateException e) {
throw new RuntimeException(e);
}
db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "tuskyDB")
.allowMainThreadQueries()
.addMigrations(AppDatabase.MIGRATION_2_3)
.addMigrations(AppDatabase.MIGRATION_3_4)
.build();
JobManager.create(this).addJobCreator(new NotificationPullJobCreator(this));
//necessary for Android < APi 21
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
示例5: ThumbLoad
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
private ThumbLoad() {
Picasso.Builder picassoBuilder = new Picasso.Builder(App.getContext());
picassoBuilder.downloader(new PicassoDownloader());
mPicasso = picassoBuilder.build();
}