use of com.nostra13.universalimageloader.core.DisplayImageOptions in project GalleryFinal by pengjianbo.
the class ChoosePhotoListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnFail(R.drawable.ic_gf_default_photo).showImageForEmptyUri(R.drawable.ic_gf_default_photo).showImageOnLoading(R.drawable.ic_gf_default_photo).build();
ImageView ivPhoto = (ImageView) mInflater.inflate(R.layout.adapter_photo_list_item, null);
setHeight(ivPhoto);
PhotoInfo photoInfo = mList.get(position);
ImageLoader.getInstance().displayImage("file:/" + photoInfo.getPhotoPath(), ivPhoto, options);
return ivPhoto;
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project GalleryFinal by pengjianbo.
the class UILImageLoader method displayImage.
@Override
public void displayImage(Activity activity, String path, GFImageView imageView, Drawable defaultDrawable, int width, int height) {
DisplayImageOptions options = new DisplayImageOptions.Builder().cacheOnDisk(false).cacheInMemory(false).bitmapConfig(mImageConfig).build();
ImageSize imageSize = new ImageSize(width, height);
ImageLoader.getInstance().displayImage("file://" + path, new ImageViewAware(imageView), options, imageSize, null, null);
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project Android-Universal-Image-Loader by nostra13.
the class LoadAndDisplayImageTask method resizeAndSaveImage.
/** Decodes image file into Bitmap, resize it and save it back */
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(uri);
if (targetFile != null && targetFile.exists()) {
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey, Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE, getDownloader(), specialOptions);
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
saved = configuration.diskCache.save(uri, bmp);
bmp.recycle();
}
}
return saved;
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project Wallpaper-Manager by Bencodes.
the class HomeActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.getSupportFragmentManager().addOnBackStackChangedListener(this);
super.setContentView(R.layout.activity_home);
this.loadData(savedInstanceState);
if (savedInstanceState == null) {
BitmapDisplayer displayer = getResources().getBoolean(R.bool.config_enable_image_fade_in) ? new FadeInBitmapDisplayer(getResources().getInteger(R.integer.config_fade_in_time)) : new SimpleBitmapDisplayer();
final DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(displayer).cacheInMemory().cacheOnDisc().build();
final ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).threadPriority(Thread.NORM_PRIORITY - 1).offOutOfMemoryHandling().tasksProcessingOrder(QueueProcessingType.FIFO).defaultDisplayImageOptions(options).build();
mImageLoader = ImageLoader.getInstance();
mImageLoader.init(config);
}
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project QuickAndroid by ImKarl.
the class QAImageLoaderConfig method getConfig.
/**
* 获取加载配置
* @param context
* @param imageOnLoading 加载中显示的图片
* @param imageOnFail 加载失败显示的图片
* @return
*/
public static ImageLoaderConfiguration getConfig(Context context, Drawable imageOnLoading, Drawable imageOnFail) {
DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnLoading(// 加载中
imageOnLoading).showImageForEmptyUri(// 图片Uri为空或是错误的时候显示的图片
imageOnFail).showImageOnFail(// resource or drawable
imageOnFail).resetViewBeforeLoading(// default
false).delayBeforeLoading(// 加载前延迟时长
50).cacheInMemory(// default = false 是否使用内存缓存
true).cacheOnDisk(// default = false 是否使用文件缓存
true).considerExifParams(// default = false
false).imageScaleType(// default
ImageScaleType.IN_SAMPLE_POWER_OF_2).bitmapConfig(// default
Bitmap.Config.ARGB_8888).displayer(// default = new SimpleBitmapDisplayer()
new FadeInBitmapDisplayer(100)).build();
File cacheDir = new File(QAFileManager.getUsableDir(context.getPackageName()));
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(// default 线程池大小
3).threadPriority(// default 线程优先级
Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().memoryCache(// 内存缓存
new LruMemoryCache(8 * 1024 * 1024)).diskCache(// default 磁盘缓存
new UnlimitedDiskCache(cacheDir)).diskCacheSize(// 磁盘缓存大小
30 * 1024 * 1024).diskCacheFileNameGenerator(// default 磁盘缓存文件名
new HashCodeFileNameGenerator()).imageDownloader(// default 图片下载器
new BaseImageDownloader(context)).imageDecoder(// default 图片解码器
new BaseImageDecoder(QACore.isDebug())).defaultDisplayImageOptions(// default=DisplayImageOptions.createSimple() 图片显示选项
options).build();
return config;
}
Aggregations