Search in sources :

Example 6 with WeakMemoryCache

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();
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) WeakMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Aggregations

WeakMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache)6 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)5 File (java.io.File)3 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)2 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)2 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)2 Handler (android.os.Handler)1 StrictMode (android.os.StrictMode)1 WebView (android.webkit.WebView)1 AsyncGoogleMusicAuthenticationTask (com.jams.music.player.AsyncTasks.AsyncGoogleMusicAuthenticationTask)1 DBAccessHelper (com.jams.music.player.DBHelpers.DBAccessHelper)1 PlaybackKickstarter (com.jams.music.player.PlaybackKickstarter.PlaybackKickstarter)1 LimitedAgeDiskCache (com.nostra13.universalimageloader.cache.disc.impl.LimitedAgeDiskCache)1 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)1 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)1