use of com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache in project android-ui-design-pattern by MathieuCalba.
the class UIDesignPatternApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
final DisplayImageOptions defaultDisplayImageOptions = //
new DisplayImageOptions.Builder().cacheInMemory().cacheOnDisc().displayer(//
new FadeInBitmapDisplayer(250)).showImageForEmptyUri(//
R.drawable.ic_launcher).showStubImage(//
R.drawable.ic_launcher).build();
final File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(), "YANA/ImageCache");
final ImageLoaderConfiguration config = //
new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(//
defaultDisplayImageOptions).discCache(//
new TotalSizeLimitedDiscCache(cacheDir, new Md5FileNameGenerator(), 10 * 1024 * 1024)).imageDownloader(//
new URLConnectionImageDownloader()).memoryCacheSize(// 2 Mb
2 * 1024 * 1024).tasksProcessingOrder(//
QueueProcessingType.LIFO).threadPoolSize(//
3).threadPriority(//
Thread.NORM_PRIORITY - 2).build();
ImageLoader.getInstance().init(config);
}
Aggregations