use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project Android-Universal-Image-Loader by nostra13.
the class ImageLoader method loadImage.
/**
* Adds load image task to execution pool. Image will be returned with
* {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}.
* <br />
* <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
*
* @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
* @param targetImageSize Minimal size for {@link Bitmap} which will be returned in
* {@linkplain ImageLoadingListener#onLoadingComplete(String, android.view.View,
* android.graphics.Bitmap)} callback}. Downloaded image will be decoded
* and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit
* larger) than incoming targetImageSize.
* @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image
* decoding and displaying. If <b>null</b> - default display image options
* {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions)
* from configuration} will be used.<br />
* @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires
* events on UI thread if this method is called on UI thread.
* @param progressListener {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
* Listener} for image loading progress. Listener fires events on UI thread if this method
* is called on UI thread. Caching on disk should be enabled in
* {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions options} to make
* this listener work.
* @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
*/
public void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) {
checkConfiguration();
if (targetImageSize == null) {
targetImageSize = configuration.getMaxImageSize();
}
if (options == null) {
options = configuration.defaultDisplayImageOptions;
}
NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP);
displayImage(uri, imageAware, options, listener, progressListener);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project PLDroidPlayer by pili-engineering.
the class MainActivity method initImageLoader.
private void initImageLoader() {
// sdcard目录
File cacheDir = StorageUtils.getOwnCacheDirectory(this, DEFAULT_CACHE_DIR_NAME);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).diskCache(// default 可以自定义缓存路径
new UnlimitedDiskCache(cacheDir)).diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100).memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(13).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ZhihuDailyPurify by izzyleung.
the class ZhihuDailyPurifyApplication method initImageLoader.
public static void initImageLoader(Context context) {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).denyCacheImageMultipleSizesInMemory().threadPriority(Thread.NORM_PRIORITY - 2).diskCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project PhotoNoter by yydcdut.
the class GalleryApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.LOG_DEBUG) {
LeakCanary.install(this);
}
YLog.setDEBUG(BuildConfig.LOG_DEBUG);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
DisplayImageOptions sOptions = new DisplayImageOptions.Builder().cacheInMemory(//设置下载的图片是否缓存在内存中
true).considerExifParams(//是否考虑JPEG图像EXIF参数(旋转,翻转)
true).bitmapConfig(//设置图片的解码类型//
Bitmap.Config.RGB_565).build();
//构建完成
PGEditImageLoader.initImageLoader(this);
PGEditSDK.instance().initSDK(this);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project UltimateAndroid by cymcsg.
the class CommonApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
ImageLoaderConfiguration config = UniversalImageLoader.getDefaultImageLoaderConfiguration(getApplicationContext());
ImageLoader.getInstance().init(config);
// ActiveAndroid.initialize(this);
AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
// CalligraphyConfig.initDefault("fonts/Satisfy-Regular.ttf", R.attr.fontPath);
}
Aggregations