本文整理汇总了Java中com.nostra13.universalimageloader.core.DisplayImageOptions.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java DisplayImageOptions.Builder方法的具体用法?Java DisplayImageOptions.Builder怎么用?Java DisplayImageOptions.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nostra13.universalimageloader.core.DisplayImageOptions
的用法示例。
在下文中一共展示了DisplayImageOptions.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOption
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
/**获取配置
* @param cornerRadiusSize
* @param defaultImageResId
* @return
*/
@SuppressWarnings("deprecation")
private static DisplayImageOptions getOption(int cornerRadiusSize, int defaultImageResId) {
Options options0 = new Options();
options0.inPreferredConfig = Bitmap.Config.RGB_565;
DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
if(defaultImageResId > 0) {
try {
builder.showImageForEmptyUri(defaultImageResId)
.showImageOnLoading(defaultImageResId)
.showImageOnFail(defaultImageResId);
} catch (Exception e) {
Log.e(TAG, "getOption try {builder.showImageForEmptyUri(defaultImageResId) ..." +
" >> } catch (Exception e) { \n" + e.getMessage());
}
}
if (cornerRadiusSize > 0) {
builder.displayer(new RoundedBitmapDisplayer(cornerRadiusSize));
}
return builder.cacheInMemory(true).cacheOnDisc(true).decodingOptions(options0).build();
}
示例2: getDefaultConfig
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
/**
* 获取图片加载器的图片的配置
*
* @param isRound 是否是加载圆形图片
* @param defaultRes 默认图片ID
* @return 返回配置
*/
public static DisplayImageOptions getDefaultConfig(boolean isRound,int defaultRes) {
DisplayImageOptions.Builder builder=new DisplayImageOptions.Builder();
// 设置缓存到内存和SD卡中,设置图片的解码格式
builder.cacheInMemory(true).cacheOnDisk(true).bitmapConfig(Bitmap.Config.RGB_565);
// 考虑JPEG图像EXIF参数(旋转和翻转)
builder.imageScaleType(ImageScaleType.EXACTLY_STRETCHED);
// 设置圆形图片
if (isRound) {
builder.considerExifParams(true).displayer(new RoundedBitmapDisplayer(12));
}
// 设置下载前图片重置复位
builder.resetViewBeforeLoading(true);
// 设置图片下载失败的时候加载默认的图片
if (defaultRes != 0) {
builder.showImageForEmptyUri(defaultRes).showImageOnFail(defaultRes);
}
return builder.build();
}
示例3: CachingUrlTileProvider
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public CachingUrlTileProvider(Context ctx, int mTileWidth, int mTileHeight) {
this.mTileWidth = mTileWidth;
this.mTileHeight = mTileHeight;
// if ImageLoader has not been instantiated by parent application yet
if (!ImageLoader.getInstance().isInited()) {
// Create global configuration and initialize ImageLoader with this config
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(ctx).build();
ImageLoader.getInstance().init(config);
}
// init ImageLoader display options
DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
builder.cacheInMemory(true).cacheOnDisk(true);
setDisplayImageOptions(builder);
mOptions = builder.build();
}
示例4: getListDisplayImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
/**
* ListView GridView RecyclerView时 ImageLoader使用该配置
* @param image_default
* @return
*/
public static DisplayImageOptions getListDisplayImageOptions(int image_default) {
DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
DisplayImageOptions options=builder
//.showImageOnLoading(R.drawable.loading) //设置图片在下载期间显示的图片
.showImageForEmptyUri(image_default)//设置图片Uri为空或是错误的时候显示的图片
.showImageOnFail(image_default) //设置图片加载/解码过程中错误时候显示的图片
.cacheInMemory(true)//设置下载的图片是否缓存在内存中
.cacheOnDisc(true)//设置下载的图片是否缓存在SD卡中
.considerExifParams(true) //是否考虑JPEG图像EXIF参数(旋转,翻转)
.imageScaleType(ImageScaleType.EXACTLY)//设置图片以如何的编码方式显示
.bitmapConfig(Bitmap.Config.RGB_565)//设置图片的解码类型
//.decodingOptions(BitmapFactory.Options decodingOptions)//设置图片的解码配置
.delayBeforeLoading(0)//int delayInMillis为你设置的下载前的延迟时间
//设置图片加入缓存前,对bitmap进行设置
//.preProcessor(BitmapProcessor preProcessor)
.resetViewBeforeLoading(false)//设置图片在下载前是否重置,复位
//.displayer(new RoundedBitmapDisplayer(20))//不推荐用!!!!是否设置为圆角,弧度为多少
//.displayer(new FadeInBitmapDisplayer(100))//是否图片加载好后渐入的动画时间,可能会出现闪动
.build();//构建完成
return options;
}
示例5: initImageLoader
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
b = new DisplayImageOptions.Builder();
b.cacheOnDisc(true)
.cacheInMemory(false)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
.bitmapConfig(Bitmap.Config.RGB_565);
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.discCacheFileNameGenerator(new Md5FileNameGenerator());
config.memoryCacheSize(20 * 1024 * 1024); // 20 MiB
config.discCacheSize(100 * 1024 * 1024); // 100 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.defaultDisplayImageOptions(b.build());
config.writeDebugLogs();
ImageLoader.getInstance().init(config.build());
}
示例6: getImageLoadingOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions.Builder getImageLoadingOptions() {
return new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.NONE)
.showImageOnLoading(R.drawable.ic_repo_app_default)
.showImageForEmptyUri(R.drawable.ic_repo_app_default)
.displayer(new FadeInBitmapDisplayer(200, true, true, false))
.bitmapConfig(Bitmap.Config.RGB_565);
}
示例7: getRawDefaultImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions.Builder getRawDefaultImageOptions()
{
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10).bitmapConfig(Bitmap.Config.RGB_565).imageScaleType(ImageScaleType.EXACTLY);
return options;
}
示例8: getWallpaperOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions getWallpaperOptions() {
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10)
.bitmapConfig(Bitmap.Config.ARGB_8888)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.cacheOnDisk(false)
.cacheInMemory(false);
return options.build();
}
示例9: getDefaultImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions getDefaultImageOptions(boolean cacheOnDisk)
{
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10)
.resetViewBeforeLoading(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.imageScaleType(ImageScaleType.EXACTLY)
.displayer(new FadeInBitmapDisplayer(700))
.cacheOnDisk(cacheOnDisk)
.cacheInMemory(false);
return options.build();
}
示例10: getDisplayImageBuilder
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions.Builder getDisplayImageBuilder(
int onLoading, int emptyUri, int onFail) {
DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
builder.resetViewBeforeLoading(false).cacheInMemory(true)
.cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
.showImageOnLoading(onLoading).showImageForEmptyUri(emptyUri)
.showImageOnFail(onFail).build();
return builder;
}
示例11: getDisplayImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions getDisplayImageOptions(int onLoading,
int emptyUri, int onFail) {
DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
builder.resetViewBeforeLoading(false).cacheInMemory(true)
.cacheOnDisc(true)
.imageScaleType(ImageScaleType.EXACTLY)
.displayer(new FadeInBitmapDisplayer(100))
.bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
.showImageOnLoading(onLoading).showImageForEmptyUri(emptyUri)
.showImageOnFail(onFail).build();
return builder.build();
}
示例12: getDefaultImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions getDefaultImageOptions() {
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10)
.resetViewBeforeLoading(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.imageScaleType(ImageScaleType.EXACTLY)
.displayer(new FadeInBitmapDisplayer(700))
.cacheOnDisk(true)
.cacheInMemory(false);
return options.build();
}
示例13: getWallpaperOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions getWallpaperOptions() {
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10)
.bitmapConfig(Bitmap.Config.ARGB_8888)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.cacheOnDisk(true)
.cacheInMemory(false);
return options.build();
}
示例14: getRawDefaultImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
public static DisplayImageOptions.Builder getRawDefaultImageOptions() {
DisplayImageOptions.Builder options = new DisplayImageOptions.Builder();
options.delayBeforeLoading(10)
.bitmapConfig(Bitmap.Config.RGB_565)
.imageScaleType(ImageScaleType.EXACTLY);
return options;
}
示例15: setDisplayImageOptions
import com.nostra13.universalimageloader.core.DisplayImageOptions; //导入方法依赖的package包/类
/**
* Allows you to set additional ImageLoader display options.<p/>
* See https://github.com/nostra13/Android-Universal-Image-Loader/wiki/Display-Options for possible options.<p/>
* Disabling the cache option DOES NOT MAKE SENSE.
*
* @param optionsBuilder options builder for setting de downloader settings
*/
protected void setDisplayImageOptions(DisplayImageOptions.Builder optionsBuilder) {
}