Search in sources :

Example 1 with TotalSizeLimitedDiscCache

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);
}
Also used : TotalSizeLimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) URLConnectionImageDownloader(com.nostra13.universalimageloader.core.download.URLConnectionImageDownloader) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Aggregations

TotalSizeLimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache)1 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)1 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)1 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)1 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)1 URLConnectionImageDownloader (com.nostra13.universalimageloader.core.download.URLConnectionImageDownloader)1 File (java.io.File)1