use of com.nostra13.universalimageloader.core.ImageLoader in project UltimateAndroid by cymcsg.
the class CommonApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
// Create global configuration and initialize ImageLoader with this configuration
ImageLoaderConfiguration config = UniversalImageLoader.getDefaultImageLoaderConfiguration(getApplicationContext());
ImageLoader.getInstance().init(config);
ActiveAndroid.initialize(this);
}
use of com.nostra13.universalimageloader.core.ImageLoader in project android-card-slide-panel by xmuSistone.
the class MainActivity method initImageLoader.
@SuppressWarnings("deprecation")
private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
13).discCacheSize(// 缓冲大小
50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
100).discCacheFileNameGenerator(// default
new HashCodeFileNameGenerator()).imageDownloader(// default
new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
DisplayImageOptions.createSimple()).writeDebugLogs().build();
// 2.单例ImageLoader类的初始化
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoader in project Android-Universal-Image-Loader by nostra13.
the class UILApplication method initImageLoader.
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
// 50 MiB
config.diskCacheSize(50 * 1024 * 1024);
config.tasksProcessingOrder(QueueProcessingType.LIFO);
// Remove for release app
config.writeDebugLogs();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
use of com.nostra13.universalimageloader.core.ImageLoader in project CustomViews by AndroidStudy233.
the class DragViewActivity method initImageLoader.
@SuppressWarnings("deprecation")
private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
13).discCacheSize(// 缓冲大小
50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
100).discCacheFileNameGenerator(// default
new HashCodeFileNameGenerator()).imageDownloader(// default
new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
DisplayImageOptions.createSimple()).writeDebugLogs().build();
// 2.单例ImageLoader类的初始化
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoader in project Slide by ccrama.
the class ImageLoaderUnescape method initImageLoader.
public static void initImageLoader(Context context) {
long discCacheSize = 1024 * 1024;
DiskCache discCache;
File dir = getCacheDirectory(context);
int threadPoolSize;
discCacheSize *= 100;
threadPoolSize = 7;
if (discCacheSize > 0) {
try {
dir.mkdir();
discCache = new LruDiskCache(dir, new Md5FileNameGenerator(), discCacheSize);
} catch (IOException e) {
discCache = new UnlimitedDiskCache(dir);
}
} else {
discCache = new UnlimitedDiskCache(dir);
}
options = new DisplayImageOptions.Builder().cacheOnDisk(true).bitmapConfig(Bitmap.Config.RGB_565).imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2).cacheInMemory(false).resetViewBeforeLoading(false).displayer(new FadeInBitmapDisplayer(250)).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(threadPoolSize).denyCacheImageMultipleSizesInMemory().diskCache(discCache).threadPoolSize(4).imageDownloader(new OkHttpImageDownloader(context)).defaultDisplayImageOptions(options).build();
if (ImageLoader.getInstance().isInited()) {
ImageLoader.getInstance().destroy();
}
imageLoader = ImageLoaderUnescape.getInstance();
imageLoader.init(config);
}
Aggregations