use of com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache in project SimplifyReader by chentao0707.
the class ImageLoaderHelper method getImageLoaderConfiguration.
public ImageLoaderConfiguration getImageLoaderConfiguration(String filePath) {
File cacheDir = null;
if (!CommonUtils.isEmpty(filePath)) {
cacheDir = StorageUtils.getOwnCacheDirectory(mContext, filePath);
} else {
cacheDir = StorageUtils.getCacheDirectory(mContext);
}
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(mContext);
builder.denyCacheImageMultipleSizesInMemory();
builder.diskCacheSize(512 * 1024 * 1024);
builder.diskCacheExtraOptions(720, 1280, null);
builder.diskCache(new UnlimitedDiscCache(cacheDir));
builder.diskCacheFileNameGenerator(new Md5FileNameGenerator());
builder.memoryCacheSizePercentage(14);
builder.memoryCacheSize(2 * 1024 * 1024);
builder.memoryCacheExtraOptions(720, 1280);
builder.memoryCache(new WeakMemoryCache());
builder.threadPoolSize(3);
builder.threadPriority(Thread.NORM_PRIORITY - 2);
builder.defaultDisplayImageOptions(getDisplayOptions());
return builder.build();
}
Aggregations