Java Code Examples for com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache

The following are top voted examples for showing how to use com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: musicplayer   File: Recommend.java   View source code 6 votes vote down vote up
private void initImageLoader() {
    File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
            .getOwnCacheDirectory(getActivity(),
                    IMAGE_CACHE_PATH);

    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true).cacheOnDisc(true).build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getActivity()).defaultDisplayImageOptions(defaultOptions)
            .memoryCache(new LruMemoryCache(12 * 1024 * 1024))
            .memoryCacheSize(12 * 1024 * 1024)
            .discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
            .discCache(new UnlimitedDiscCache(cacheDir))
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.LIFO).build();

    ImageLoader.getInstance().init(config);
}
 
Example 2
Project: CloudMusic   File: ToolImage.java   View source code 6 votes vote down vote up
/**
 * 初始化ImageLoader
 */
public static void initImageLoader(Context context) {
    //缓存文件的目录
    File cacheDir = CacheUtil.getDiskCacheDir(context, "images");
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // max width, max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3) //线程池内加载的数量
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //将保存的时候的URI名称用MD5 加密
            .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation/你可以通过自己的内存缓存实现
            .memoryCacheSize(2 * 1024 * 1024) // 内存缓存的最大值
            .diskCacheSize(50 * 1024 * 1024)  // 50 Mb sd卡(本地)缓存的最大值
            .tasksProcessingOrder(QueueProcessingType.LIFO)
                    // 由原先的discCache -> diskCache
            .diskCache(new UnlimitedDiscCache(cacheDir))//自定义缓存路径
            .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
            .writeDebugLogs() // Remove for release app
            .build();
    //全局初始化此配置
    ImageLoader.getInstance().init(config);

}
 
Example 3
Project: YingBeautyNote   File: BaseApplication.java   View source code 6 votes vote down vote up
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
    File cacheDir = StorageUtils.getOwnCacheDirectory(context,
            "beautynote/cache");// 获取到缓存的目录地址
    // 创建配置ImageLoader(所有的选项都是可选的,只使用那些你真的想定制),这个可以设定在APPLACATION里面,设置为全局的配置参数
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            context)

            // 线程池内加载的数量
            .threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
            .memoryCache(new WeakMemoryCache())
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            // 将保存的时候的URI名称用MD5 加密
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径
            // .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
            .writeDebugLogs() // Remove for release app
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);// 全局初始化此配置
}
 
Example 4
Project: android-open-project-demo-master   File: DefaultConfigurationFactory.java   View source code 6 votes vote down vote up
/**
 * Creates default implementation of {@link DiskCache} depends on incoming parameters
 */
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
		long diskCacheSize, int diskCacheFileCount) {
	File reserveCacheDir = createReserveDiskCacheDir(context);
	if (diskCacheSize > 0 || diskCacheFileCount > 0) {
		File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
		try {
			return new LruDiscCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
					diskCacheFileCount);
		} catch (IOException e) {
			L.e(e);
			// continue and create unlimited cache
		}
	}
	File cacheDir = StorageUtils.getCacheDirectory(context);
	return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
 
Example 5
Project: android-open-project-demo-master   File: HuxianApplication.java   View source code 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    File cacheDir = StorageUtils.getCacheDirectory(this);
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCache(new UnlimitedDiscCache(cacheDir))
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13)
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .build();
    ImageLoader.getInstance().init(configuration);
}
 
Example 6
Project: mobile-manager-tool   File: DefaultConfigurationFactory.java   View source code 6 votes vote down vote up
/**
 * Creates default implementation of {@link DiskCache} depends on incoming parameters
 */
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
		long diskCacheSize, int diskCacheFileCount) {
	File reserveCacheDir = createReserveDiskCacheDir(context);
	if (diskCacheSize > 0 || diskCacheFileCount > 0) {
		File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
		try {
			return new LruDiscCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
					diskCacheFileCount);
		} catch (IOException e) {
			L.e(e);
			// continue and create unlimited cache
		}
	}
	File cacheDir = StorageUtils.getCacheDirectory(context);
	return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
 
Example 7
Project: enjoychat   File: CustomApplication.java   View source code 6 votes vote down vote up
/**
 * ��ʼ��ImageLoader
 * 
 * @param applicationContext
 */
private static void initImageLoader(Context context) {
	File cacheDir = StorageUtils.getOwnCacheDirectory(context,
			"bmobchat/Cache");// ��ȡ�������Ŀ¼��ַ
	// ��������ImageLoader(���е�ѡ��ǿ�ѡ��,ֻʹ����Щ������붨��)����������趨��APPLACATION���棬����Ϊȫ�ֵ����ò���
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			context)
			// �̳߳��ڼ��ص�����
			.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
			.memoryCache(new WeakMemoryCache())
			.denyCacheImageMultipleSizesInMemory()
			.discCacheFileNameGenerator(new Md5FileNameGenerator())
			// �������ʱ���URI������MD5 ����
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.discCache(new UnlimitedDiscCache(cacheDir))// �Զ��建��·��
			// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
			.writeDebugLogs() // Remove for release app
			.build();
	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config);// ȫ�ֳ�ʼ��������
}
 
Example 8
Project: XPPLE_IM   File: CustomApplcation.java   View source code 6 votes vote down vote up
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
	File cacheDir = StorageUtils.getOwnCacheDirectory(context,
			"bmobim/Cache");// 获取到缓存的目录地址
	// 创建配置ImageLoader(所有的选项都是可选的,只使用那些你真的想定制),这个可以设定在APPLACATION里面,设置为全局的配置参数
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			context)
			// 线程池内加载的数量
			.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
			.memoryCache(new WeakMemoryCache())
			.denyCacheImageMultipleSizesInMemory()
			.discCacheFileNameGenerator(new Md5FileNameGenerator())
			// 将保存的时候的URI名称用MD5 加密
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径
			// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
			.writeDebugLogs() // Remove for release app
			.build();
	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config);// 全局初始化此配置
}
 
Example 9
Project: Hi   File: CustomApplication.java   View source code 6 votes vote down vote up
/** ��ʼ��ImageLoader */
public static void initImageLoader(Context context) {
	File cacheDir = StorageUtils.getOwnCacheDirectory(context,
			"bmobim/Cache");// ��ȡ�������Ŀ¼��ַ
	// ��������ImageLoader(���е�ѡ��ǿ�ѡ��,ֻʹ����Щ������붨��)����������趨��APPLACATION���棬����Ϊȫ�ֵ����ò���
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			context)
			// �̳߳��ڼ��ص�����
			.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
			.memoryCache(new WeakMemoryCache())
			.denyCacheImageMultipleSizesInMemory()
			.discCacheFileNameGenerator(new Md5FileNameGenerator())
			// �������ʱ���URI������MD5 ����
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.discCache(new UnlimitedDiscCache(cacheDir))// �Զ��建��·��
			// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
			.writeDebugLogs() // Remove for release app
			.build();
	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config);// ȫ�ֳ�ʼ��������
}
 
Example 10
Project: Studddinv2_android   File: CustomGalleryActivity.java   View source code 6 votes vote down vote up
private void initImageLoader() {
    try {
        String CACHE_DIR = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/.temp_tmp";
        new File(CACHE_DIR).mkdirs();

        File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(),
                CACHE_DIR);

        DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
                .cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY)
                .bitmapConfig(Bitmap.Config.RGB_565).build();
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(
                getBaseContext())
                .defaultDisplayImageOptions(defaultOptions)
                .discCache(new UnlimitedDiscCache(cacheDir))
                .memoryCache(new WeakMemoryCache());

        ImageLoaderConfiguration config = builder.build();
        imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);

    } catch (Exception e) {

    }
}
 
Example 11
Project: MultipleImagePicker   File: CustomGalleryActivity.java   View source code 6 votes vote down vote up
private void initImageLoader() {
	try {
		String CACHE_DIR = Environment.getExternalStorageDirectory()
				.getAbsolutePath() + "/.temp_tmp";
		new File(CACHE_DIR).mkdirs();

		File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(),
				CACHE_DIR);

		DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
				.cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY)
				.bitmapConfig(Bitmap.Config.RGB_565).build();
		ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(
				getBaseContext())
				.defaultDisplayImageOptions(defaultOptions)
				.discCache(new UnlimitedDiscCache(cacheDir))
				.memoryCache(new WeakMemoryCache());

		ImageLoaderConfiguration config = builder.build();
		imageLoader = ImageLoader.getInstance();
		imageLoader.init(config);

	} catch (Exception e) {

	}
}
 
Example 12
Project: mvideo   File: HomePageFragment2.java   View source code 6 votes vote down vote up
private void initImageLoader() {
	File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
			.getOwnCacheDirectory(this.getActivity().getApplicationContext(),
					IMAGE_CACHE_PATH);

	DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
			.cacheInMemory(true).cacheOnDisc(true).build();

	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			this.getActivity()).defaultDisplayImageOptions(defaultOptions)
			.memoryCache(new LruMemoryCache(12 * 1024 * 1024))
			.memoryCacheSize(12 * 1024 * 1024)
			.discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
			.discCache(new UnlimitedDiscCache(cacheDir))
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.tasksProcessingOrder(QueueProcessingType.LIFO).build();

	ImageLoader.getInstance().init(config);
}
 
Example 13
Project: mvideo   File: VideoInfoFragment.java   View source code 6 votes vote down vote up
private void initImageLoader() {
	File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
			.getOwnCacheDirectory(this.getActivity().getApplicationContext(),
					IMAGE_CACHE_PATH);

	DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
			.cacheInMemory(true).cacheOnDisc(true).build();

	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			this.getActivity()).defaultDisplayImageOptions(defaultOptions)
			.memoryCache(new LruMemoryCache(12 * 1024 * 1024))
			.memoryCacheSize(12 * 1024 * 1024)
			.discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
			.discCache(new UnlimitedDiscCache(cacheDir))
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.tasksProcessingOrder(QueueProcessingType.LIFO).build();

	ImageLoader.getInstance().init(config);
}
 
Example 14
Project: mvideo   File: HomePageFragment.java   View source code 6 votes vote down vote up
private void initImageLoader() {
	File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
			.getOwnCacheDirectory(this.getActivity().getApplicationContext(),
					IMAGE_CACHE_PATH);

	DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
			.cacheInMemory(true).cacheOnDisc(true).build();

	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			this.getActivity()).defaultDisplayImageOptions(defaultOptions)
			.memoryCache(new LruMemoryCache(12 * 1024 * 1024))
			.memoryCacheSize(12 * 1024 * 1024)
			.discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
			.discCache(new UnlimitedDiscCache(cacheDir))
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.tasksProcessingOrder(QueueProcessingType.LIFO).build();

	ImageLoader.getInstance().init(config);
}
 
Example 15
Project: DoubanOnline   File: MyApplication.java   View source code 6 votes vote down vote up
/**
 * http://seniorzhai.github.io/2014/10/14/UIL%E5%9B%BE%E7%89%87%E5%BC%82%E6%AD%A5%E5%8A%A0%E8%BD%BD%E5%BA%93%E7%9A%84%E4%BD%BF%E7%94%A8/
 * */
private void iniImageLoader()
{
	File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(),"doubanonlineimageloader/Cache");
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
	.memoryCache(new WeakMemoryCache())
	.denyCacheImageMultipleSizesInMemory()
	.offOutOfMemoryHandling()
	.discCacheExtraOptions(720, 480, CompressFormat.JPEG, 75)
	.discCache(new UnlimitedDiscCache(cacheDir))
	.imageDownloader(new URLConnectionImageDownloader(120 * 1000, 120 * 1000))
	.enableLogging()
	.build();
	ImageLoader.getInstance().init(config);
	imageLoader = ImageLoader.getInstance();
}
 
Example 16
Project: taijiquanwang   File: BaseApplication.java   View source code 6 votes vote down vote up
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
	File cacheDir = StorageUtils.getOwnCacheDirectory(context, "taijiquan/Cache");//获取到缓存的目录地址
	TLog.logd(cacheDir.getPath());
       DisplayImageOptions displayOptions = new DisplayImageOptions.Builder()
               .cacheInMemory(true)
               .bitmapConfig(Bitmap.Config.RGB_565)
               .showImageOnLoading(R.drawable.ic_full_image_failed)
               .showImageOnFail(R.drawable.ic_full_image_failed)
               .build();
	ImageLoaderConfiguration config = new ImageLoaderConfiguration
			.Builder(context)
			.threadPoolSize(3)
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.denyCacheImageMultipleSizesInMemory()
			.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation你可以通过自己的内存缓存实现
			.memoryCacheSize(2 * 1024 * 1024)
               .discCacheSize(50 * 1024 * 1024)
			.discCacheFileNameGenerator(new Md5FileNameGenerator())//将保存的时候的URI名称用MD5 加密
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.discCacheFileCount(100)
			.discCache(new UnlimitedDiscCache(cacheDir))
               .defaultDisplayImageOptions(displayOptions)
			.build();
	ImageLoader.getInstance().init(config);
}
 
Example 17
Project: RecyclerView-Animation-Demo   File: App.java   View source code 6 votes vote down vote up
private void initImageLoader() {

    	DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
        .cacheInMemory(false)
        .imageScaleType(ImageScaleType.EXACTLY)
        .cacheOnDisk(true)
        .build();
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .defaultDisplayImageOptions(defaultOptions)
            .denyCacheImageMultipleSizesInMemory()
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCache(new UnlimitedDiscCache(StorageUtils.getOwnCacheDirectory(this, Environment.getExternalStorageDirectory()
                    + "/sky")))
            .diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO)
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024)
            .threadPoolSize(3)
            .build();
        ImageLoader.getInstance().init(config);
    }
 
Example 18
Project: snowdream-books-android   File: MainApplication.java   View source code 6 votes vote down vote up
private void initImageLoader(){
        Context context = getApplicationContext();
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .threadPriority(Thread.NORM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimitedDiscCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
 
Example 19
Project: v2ex-daily-android   File: Application.java   View source code 6 votes vote down vote up
private void initiImageLoader() {
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .imageScaleType(ImageScaleType.EXACTLY)
            .cacheOnDisc(true)
            .displayer(new FadeInBitmapDisplayer(200))
            .showImageOnLoading(R.drawable.ic_launcher)
            .build();

    File cacheDir;
    if(Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED){
        cacheDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
    }else{
        cacheDir = getCacheDir();
    }
    ImageLoaderConfiguration.Builder configBuilder = new ImageLoaderConfiguration.Builder(mContext)
            .threadPoolSize(2)
            .memoryCache(new WeakMemoryCache())
            .denyCacheImageMultipleSizesInMemory()
            .discCache(new UnlimitedDiscCache(cacheDir))
            .defaultDisplayImageOptions(options);
    if(BuildConfig.DEBUG){
        configBuilder.writeDebugLogs();
    }
    ImageLoader.getInstance().init(configBuilder.build());
}
 
Example 20
Project: snowdream-jokes-android   File: MainApplication.java   View source code 6 votes vote down vote up
private void initImageLoader(){
        Context context = getApplicationContext();
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .threadPriority(Thread.NORM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimitedDiscCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
 
Example 21
Project: light-novel-library_Wenku8_Android   File: GlobalConfig.java   View source code 6 votes vote down vote up
public static void initImageLoader(Context context) {
    UnlimitedDiscCache localUnlimitedDiscCache = new UnlimitedDiscCache(
            new File(GlobalConfig.getFirstStoragePath() + "cache"),
            new File(context.getCacheDir() + File.separator + "imgs"));
    DisplayImageOptions localDisplayImageOptions = new DisplayImageOptions.Builder()
            .resetViewBeforeLoading(true)
            .cacheOnDisk(true)
            .cacheInMemory(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .resetViewBeforeLoading(true)
            .displayer(new FadeInBitmapDisplayer(250)).build();
    ImageLoaderConfiguration localImageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context)
            .diskCache(localUnlimitedDiscCache)
            .defaultDisplayImageOptions(localDisplayImageOptions).build();
    ImageLoader.getInstance().init(localImageLoaderConfiguration);
}
 
Example 22
Project: okulus   File: DemoApplication.java   View source code 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    mRequestQueue = Volley.newRequestQueue(this);
    mImageLoader = new ImageLoader(mRequestQueue, new ImageLoader.ImageCache() {
        private final LruCache<String, Bitmap>
                cache = new LruCache<>(20);

        @Override
        public Bitmap getBitmap(String url) {
            return cache.get(url);
        }

        @Override
        public void putBitmap(String url, Bitmap bitmap) {
            cache.put(url, bitmap);
        }
    });

    final File cacheDirectory = StorageUtils.getCacheDirectory(this);
    final ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
            .diskCache(new UnlimitedDiscCache(cacheDirectory))
            .build();
    com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);
}
 
Example 23
Project: UltimateAndroid   File: UniversalImageLoader.java   View source code 6 votes vote down vote up
public static ImageLoaderConfiguration.Builder getDefaultImageLoaderConfigurationBuilder(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
//                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
//                .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null)
                .threadPoolSize(3) // default
                .threadPriority(Thread.NORM_PRIORITY - 1) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
//                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
//                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .discCache(new UnlimitedDiscCache(cacheDir)) // default
//                .discCacheSize(50 * 1024 * 1024)
                .discCacheFileCount(1000)
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                        //   .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
                .defaultDisplayImageOptions(getDefaultImageOptions());
        return builder;
    }
 
Example 24
Project: android-open-project-demo   File: DefaultConfigurationFactory.java   View source code 6 votes vote down vote up
/**
 * Creates default implementation of {@link DiskCache} depends on incoming parameters
 */
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
		long diskCacheSize, int diskCacheFileCount) {
	File reserveCacheDir = createReserveDiskCacheDir(context);
	if (diskCacheSize > 0 || diskCacheFileCount > 0) {
		File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
		try {
			return new LruDiscCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
					diskCacheFileCount);
		} catch (IOException e) {
			L.e(e);
			// continue and create unlimited cache
		}
	}
	File cacheDir = StorageUtils.getCacheDirectory(context);
	return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
 
Example 25
Project: android-open-project-demo   File: HuxianApplication.java   View source code 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    File cacheDir = StorageUtils.getCacheDirectory(this);
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCache(new UnlimitedDiscCache(cacheDir))
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13)
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .build();
    ImageLoader.getInstance().init(configuration);
}
 
Example 26
Project: android-imageviewer   File: MainApplication.java   View source code 6 votes vote down vote up
public static void initImageLoader(Context context) {
    File cacheDir = StorageUtils.getCacheDirectory(context);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
            .denyCacheImageMultipleSizesInMemory()
            .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null)
            .threadPriority(Thread.NORM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .discCache(new UnlimitedDiscCache(cacheDir)) // default
            .discCacheSize(50 * 1024 * 1024)
            .discCacheFileCount(100)
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .imageDecoder(new BaseImageDecoder(true)) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
            .writeDebugLogs()
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example 27
Project: disciples-of-duarte-repo   File: KioskApplication.java   View source code 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    // Setup Timber
    if(BuildConfig.DEBUG){
        Timber.plant(new Timber.DebugTree());
    }

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
            .memoryCache(new LruMemoryCache(10 * 1024 * 1024))
            .diskCache(new UnlimitedDiscCache(getCacheDir()))
            .build();

    ImageLoader.getInstance().init(config);

}
 
Example 28
Project: android-opensource-library-56   File: AndroidUniversalImageLoaderSampleApplication.java   View source code 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getApplicationContext())
            .threadPoolSize(3)
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .discCache(
                    new UnlimitedDiscCache(StorageUtils
                            .getCacheDirectory(getApplicationContext())))
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example 29
Project: TYT   File: MyApplication.java   View source code 5 votes vote down vote up
/**
 * 初始化ImageLoader
 */
public static void initImageLoader(Context context) {
    // 哪个地方想要清除自定义路径下的缓存,就在那里调用这个方法
    //  ImageLoader.getInstance().clearDiscCache(); // 清除自定义的ImageLoader缓存的图片

    // 自定义的缓存路径ImageLoaderCache:sdcard/picture/ImageLoaderCache ,属于外部缓存
    File cacheDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "ImageLoaderCache");
    if (!cacheDir.exists()) {
        cacheDir.mkdir();
    }

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // maxwidth, max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)//线程池内加载的数量
            .denyCacheImageMultipleSizesInMemory()
            //.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) //你可以通过自己的内存缓存实现,那么getCache()就能获取到缓存图片,在data/data/xxx.xxx.xxx/cache 文件夹下
            //.memoryCacheSize(2 * 1024 * 1024)  // 内存缓存大小
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .diskCacheFileCount(100) //缓存图片的个数
            .discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径 ,这个注释的话,就没有自定的缓存了,不过还可以设置内部缓存
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
            .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
            .writeDebugLogs() // Remove for releaseapp
            .build();//开始构建
    ImageLoader.getInstance().init(config);

}
 
Example 30
Project: letv   File: DefaultConfigurationFactory.java   View source code 5 votes vote down vote up
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator, long diskCacheSize, int diskCacheFileCount) {
    File reserveCacheDir = createReserveDiskCacheDir(context);
    if (diskCacheSize > 0 || diskCacheFileCount > 0) {
        try {
            return new LruDiscCache(StorageUtils.getIndividualCacheDirectory(context), reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount);
        } catch (IOException e) {
            L.e(e);
        }
    }
    return new UnlimitedDiscCache(StorageUtils.getCacheDirectory(context), reserveCacheDir, diskCacheFileNameGenerator);
}
 
Example 31
Project: sctalk   File: ImageLoaderUtil.java   View source code 5 votes vote down vote up
public static void initImageLoaderConfig(Context context) {
        try {
            File cacheDir = StorageUtils.getOwnCacheDirectory(context, CommonUtil.getSavePath(SysConstant.FILE_SAVE_TYPE_IMAGE));
            File reserveCacheDir = StorageUtils.getCacheDirectory(context);

            int maxMemory = (int) (Runtime.getRuntime().maxMemory() );
            // 使用最大可用内存值的1/8作为缓存的大小。
            int cacheSize = maxMemory/8;
            DisplayMetrics metrics=new DisplayMetrics();
            WindowManager mWm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
            mWm.getDefaultDisplay().getMetrics(metrics);

            IMImageLoaderConfig = new ImageLoaderConfiguration.Builder(context)
                    .memoryCacheExtraOptions(metrics.widthPixels, metrics.heightPixels)
                    .threadPriority(Thread.NORM_PRIORITY-2)
//                    .denyCacheImageMultipleSizesInMemory()
                    .memoryCache(new UsingFreqLimitedMemoryCache(cacheSize))
                    .diskCacheFileNameGenerator(new Md5FileNameGenerator())
                    .tasksProcessingOrder(QueueProcessingType.LIFO)
                    .diskCacheExtraOptions(metrics.widthPixels, metrics.heightPixels, null)
                    .diskCache(new UnlimitedDiscCache(cacheDir,reserveCacheDir,new Md5FileNameGenerator()))
                    .diskCacheSize(1024 * 1024 * 1024)
                    .diskCacheFileCount(1000)
                    .build();

            IMImageLoadInstance = ImageLoader.getInstance();
            IMImageLoadInstance.init(IMImageLoaderConfig);
        }catch (Exception e){
            logger.e(e.toString());
        }
    }
 
Example 32
Project: TAG   File: DemoApplication.java   View source code 5 votes vote down vote up
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
	File cacheDir = StorageUtils.getOwnCacheDirectory(context,
			Constant.CACHE_DIR_IMAGE );// 获取到缓存的目录地址
	Log.d("cacheDir"+ cacheDir.getPath() );
	// 创建配置ImageLoader(所有的选项都是可选的,只使用那些你真的想定制),这个可以设定在APPLACATION里面,设置为全局的配置参数
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
	// 线程池内加载的数量
			.threadPoolSize(3)
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.memoryCache(new WeakMemoryCache())
			.denyCacheImageMultipleSizesInMemory()
			/***新增*** /
			.memoryCache(new LruMemoryCache(2 * 1024 * 1024))  
	        .memoryCacheSize(2 * 1024 * 1024)  
	        .memoryCacheSizePercentage(13) // default  
	        /***新增end***/
			.discCacheFileNameGenerator(new Md5FileNameGenerator())
			// 将保存的时候的URI名称用MD5 加密
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.discCache(new UnlimitedDiscCache(cacheDir))// 自定义缓存路径
			// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
			.writeDebugLogs() // Remove for release app
			.build();
	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config);// 全局初始化此配置
}
 
Example 33
Project: aptoide-client   File: Aptoide.java   View source code 5 votes vote down vote up
/**
 * Inits nostra13's ImageLoader
 */
private void initImageLoader() {

    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .resetViewBeforeLoading(true)
            .showStubImage(R.drawable.icon_non_available)
            .build();

    FileNameGenerator generator = new FileNameGenerator() {
        @Override
        public String generate(String s) {

            if(s!=null){
                return s.substring(s.lastIndexOf('/') + 1);
            } else {
                return null;
            }
        }
    };

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .discCache(new UnlimitedDiscCache(new File(getConfiguration().getPathCacheIcons()), null, generator))
            .imageDownloader(new ImageDownloaderWithPermissions(getContext()))
            .defaultDisplayImageOptions(options)
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example 34
Project: zhai   File: AppApplication.java   View source code 5 votes vote down vote up
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {


	//创建配置ImageLoader(所有的选项都是可选的,只使用那些你真的想定制),这个可以设定在APPLACATION里面,设置为全局的配置参数
	ImageLoaderConfiguration config = new ImageLoaderConfiguration
			.Builder(context)
			//.memoryCacheExtraOptions(480, 800) // max width, max height,即保存的每个缓存文件的最大长宽
			//.discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75, null) // Can slow ImageLoader, use it carefully (Better don't use it)设置缓存的详细信息,最好不要设置这个
			.threadPoolSize(5)//线程池内加载的数量
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.denyCacheImageMultipleSizesInMemory()
			//.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation你可以通过自己的内存缓存实现
			//.memoryCacheSize(5 * 1024 * 1024)
			//.discCacheSize(50 * 1024 * 1024)
			//.discCacheFileNameGenerator(new Md5FileNameGenerator())//将保存的时候的URI名称用MD5 加密
			.discCacheFileNameGenerator(null)//将保存的时候的URI名称用HASHCODE加密
			.tasksProcessingOrder(QueueProcessingType.FIFO)
			.discCacheFileCount(500) //缓存的File数量
			.discCache(new UnlimitedDiscCache(cache("zhai/Cache")))//自定义缓存路径
			//.defaultDisplayImageOptions(DisplayImageOptions.createSimple())
			//.imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
			//.writeDebugLogs() // Remove for release app
			.build();
	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config);//全局初始化此配置
}
 
Example 35
Project: SimplifyReader2   File: ImageLoaderHelper.java   View source code 5 votes vote down vote up
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();
}
 
Example 36
Project: JokeAndroidClient   File: UniversalImageLoaderUtils.java   View source code 5 votes vote down vote up
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();
}
 
Example 37
Project: meipaiAll   File: MyApplication.java   View source code 5 votes vote down vote up
private void initImageLoaderConfig() {
    /**
     * universal image loader 配置文件
     */
    @SuppressWarnings("deprecation")
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(180, 320)
            // max width, max height,即保存的每个缓存文件的最大长宽
            // .discCacheExtraOptions(180, 320, null)
            // 设置缓存的详细信息,最好不要设置这个
            .threadPoolSize(3)
                    // 线程池内加载的数量 推荐1-5
            .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
            .memoryCache(new WeakMemoryCache())
                    // implementation/你可以通过自己的内存缓存实现
            .memoryCacheSize(2 * 1024 * 1024).discCacheSize(50 * 1024 * 1024)
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
                    // 将保存的时候的URI名称用MD5 加密
            .tasksProcessingOrder(QueueProcessingType.LIFO).discCacheFileCount(100)
                    // 缓存的文件数量
            .discCache(
                    new UnlimitedDiscCache(new File(Environment.getExternalStorageDirectory() + "/myApp/imgCache")))
                    // 自定义缓存路径
            .defaultDisplayImageOptions(getDisplayOptions())
            .imageDownloader(new BaseImageDownloader(this, 5 * 1000, 30 * 1000)).writeDebugLogs() // Remove
                    // for
                    // release
                    // app
            .build();// 开始构建
    com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);

}
 
Example 38
Project: EveryXDay   File: DefaultConfigurationFactory.java   View source code 5 votes vote down vote up
/**
 * Creates default implementation of {@link DiskCache} depends on incoming parameters
 */
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
		long diskCacheSize, int diskCacheFileCount) {
	File reserveCacheDir = createReserveDiskCacheDir(context);
	if (diskCacheSize > 0 || diskCacheFileCount > 0) {
		File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
		LruDiscCache diskCache = new LruDiscCache(individualCacheDir, diskCacheFileNameGenerator, diskCacheSize,
				diskCacheFileCount);
		diskCache.setReserveCacheDir(reserveCacheDir);
		return diskCache;
	} else {
		File cacheDir = StorageUtils.getCacheDirectory(context);
		return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
	}
}
 
Example 39
Project: EveryXDay   File: EveryXDayApplication.java   View source code 5 votes vote down vote up
public void initImageLoader(Context context) {

        File cacheDir = new File(mLocalStorageUtil.getImageCacheAbsoluteDir());

        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .threadPriority(Thread.NORM_PRIORITY - 2)
                .denyCacheImageMultipleSizesInMemory()
                .diskCacheFileNameGenerator(new Md5FileNameGenerator())
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .diskCache(new UnlimitedDiscCache(cacheDir))
//				.writeDebugLogs() // Remove for release app
                .build();
        ImageLoader.getInstance().init(config);
    }
 
Example 40
Project: SimplifyReader   File: ImageLoaderHelper.java   View source code 5 votes vote down vote up
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();
}