Search in sources :

Example 6 with Builder

use of com.nostra13.universalimageloader.core.DisplayImageOptions.Builder 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

ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)4 File (java.io.File)3 Bitmap (android.graphics.Bitmap)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)2 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)2 FailReason (com.nostra13.universalimageloader.core.assist.FailReason)2 Options (android.graphics.BitmapFactory.Options)1 NonNull (android.support.annotation.NonNull)1 Px (android.support.annotation.Px)1 TextView (android.widget.TextView)1 Palette (androidx.palette.graphics.Palette)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 Optional (com.alexstyl.specialdates.Optional)1 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)1 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)1 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)1 WeakMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache)1 Builder (com.nostra13.universalimageloader.core.DisplayImageOptions.Builder)1