com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator Java Examples

The following examples show how to use com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HuxianApplication.java    From android-open-project-demo with Apache License 2.0 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 #2
Source File: MyApplication.java    From WliveTV with Apache License 2.0 6 votes vote down vote up
public static void initImageLoader(Context context) {
        // This configuration tuning is custom. You can tune every option, you may tune some of them,
        // or you can create default configuration by
        //  ImageLoaderConfiguration.createDefault(this);
        // method.
        ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
        config.threadPriority(Thread.NORM_PRIORITY - 4);
//        config.memoryCache(new WeakMemoryCache());
        config.memoryCacheExtraOptions(480, 800);
        config.memoryCacheSize(2 * 1024 * 1024);
        config.denyCacheImageMultipleSizesInMemory();
        config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
        config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
        config.diskCacheExtraOptions(480, 800, null);
        config.tasksProcessingOrder(QueueProcessingType.LIFO);
//        config.writeDebugLogs(); // Remove for release app
        config.imageDownloader(new BaseImageDownloader(context, 5 * 1000, 10 * 1000));
        config.threadPoolSize(1);
        // Initialize ImageLoader with configuration.
        ImageLoader.getInstance().init(config.build());
    }
 
Example #3
Source File: EditorActivity.java    From RichEditText with Apache License 2.0 6 votes vote down vote up
public void initImageLoader(Context context) {
	// This configuration tuning is custom. You can tune every option, you
	// may tune some of them,
	// or you can create default configuration by
	// ImageLoaderConfiguration.createDefault(this);
	// method.
	ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(
			context);
	config.threadPriority(Thread.NORM_PRIORITY - 2);
	config.denyCacheImageMultipleSizesInMemory();
	config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
	config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
	config.tasksProcessingOrder(QueueProcessingType.LIFO);
	config.writeDebugLogs(); // Remove for release app

	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config.build());
	
}
 
Example #4
Source File: MainActivity.java    From GalleryFinal with Apache License 2.0 6 votes vote down vote up
private void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you may tune some of them,
    // or you can create default configuration by
    //  ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for release app

    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}
 
Example #5
Source File: App.java    From RecyclerView-Animation-Demo with Apache License 2.0 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 #6
Source File: SimpleImageAct.java    From ZoomImageView with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_simple_image);

    ziv = (ZoomImageView) findViewById(R.id.ziv);
    ziv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SimpleImageAct.this.finish();
        }
    });
    group = (RadioGroup) findViewById(R.id.group);
    RadioButton child = (RadioButton) group.getChildAt(0);
    child.setChecked(true);
    ImageLoader.getInstance().init(new ImageLoaderConfiguration.Builder(this)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .build());
}
 
Example #7
Source File: BaseApplication.java    From BigApp_WordPress_Android with Apache License 2.0 6 votes vote down vote up
private void initUil() {
    File cacheDir = SdCacheTools.getOwnImageCacheDir(this);
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCache(new UnlimitedDiskCache(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 #8
Source File: MyApplication.java    From GithubTrends with Apache License 2.0 6 votes vote down vote up
public void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you may tune some of them,
    // or you can create default configuration by
    //  ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCacheSizePercentage(25)
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCacheSize(100 * 1024 * 1024)
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .writeDebugLogs() // Remove for release app
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
 
Example #9
Source File: ImageLoadUtil.java    From mobile-manager-tool with MIT License 6 votes vote down vote up
public static void configuration(Context context) {
    if (imageLoader == null) {
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
                .discCacheSize(MAX_DISK_CACHE_FILE_SIZE)
                        // .discCacheFileCount(MAX_DISK_CACHE_FILE_COUNT)
                .discCacheFileNameGenerator(new Md5FileNameGenerator())
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                        // .writeDebugLogs() // 输入日志,打包发布的时候注释掉
                .build();

        ImageLoader.getInstance().init(config);

        imageLoader = ImageLoader.getInstance();
    }
}
 
Example #10
Source File: ClientApplication.java    From android-tv-launcher with MIT License 6 votes vote down vote up
/**
 * init UIL ImageLoader
 */
public static void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you
    // may tune some of them,
    // or you can create default configuration by
    // ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            context).threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .writeDebugLogs() // Remove for release app
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
 
Example #11
Source File: FreeIOTApp.java    From freeiot-android with MIT License 6 votes vote down vote up
public static void initImageLoader(Context context) {
		// This configuration tuning is custom. You can tune every option, you may tune some of them,
		// or you can create default configuration by
		//  ImageLoaderConfiguration.createDefault(this);
		// method.
		ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
		config.threadPriority(Thread.NORM_PRIORITY - 2);
		config.denyCacheImageMultipleSizesInMemory();
		config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
		config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
		config.tasksProcessingOrder(QueueProcessingType.LIFO);
//		config.writeDebugLogs(); // Remove for release app

		// Initialize ImageLoader with configuration.
		ImageLoader.getInstance().init(config.build());
	}
 
Example #12
Source File: UILKit.java    From XRichText with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化
 *
 * @param context
 */
private UILKit(Context context) {
    File cacheDir = getDiskCacheDir(context, "img");

    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCacheSize(10 * 1024 * 1024)
            .diskCache(new UnlimitedDiskCache(cacheDir))
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCacheSize(50 * 1024 * 1024) // 50 MiB
            .tasksProcessingOrder(QueueProcessingType.LIFO);

    ImageLoader.getInstance().init(config.build());



    picOptions = new DisplayImageOptions.Builder()
            .imageScaleType(ImageScaleType.EXACTLY)
            .cacheOnDisk(false).cacheInMemory(false)
            .resetViewBeforeLoading(true)
            .displayer(new FadeInBitmapDisplayer(500)).build();
}
 
Example #13
Source File: UILApplication.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 6 votes vote down vote up
public static void initImageLoader(Context context) {
	// This configuration tuning is custom. You can tune every option, you may tune some of them,
	// or you can create default configuration by
	//  ImageLoaderConfiguration.createDefault(this);
	// method.
	ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
	config.threadPriority(Thread.NORM_PRIORITY - 2);
	config.denyCacheImageMultipleSizesInMemory();
	config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
	config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
	config.tasksProcessingOrder(QueueProcessingType.LIFO);
	config.writeDebugLogs(); // Remove for release app

	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config.build());
}
 
Example #14
Source File: DemoApplication.java    From base-adapter-helper-recyclerview with Apache License 2.0 5 votes vote down vote up
private void initImageLoader(Context context) {
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for release app

    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}
 
Example #15
Source File: ICApplication.java    From ImageChooser with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化ImageLoader
 * 
 * @param context
 */
public static void initImageLoader(Context context) {
    ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .memoryCache(new WeakMemoryCache()).discCacheSize(8 * 1024 * 1024)
            .tasksProcessingOrder(QueueProcessingType.LIFO);
    // 如果是调试模式,输出日志,否则不输出
    if (BuildConfig.DEBUG) {
        builder.writeDebugLogs();
    }
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(builder.build());
}
 
Example #16
Source File: BraceletImageLoader.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void a(Context context)
{
    File file = new File(((BraceletApp)context).getStoragePath());
    com.nostra13.universalimageloader.core.ImageLoaderConfiguration imageloaderconfiguration = (new com.nostra13.universalimageloader.core.ImageLoaderConfiguration.Builder(context)).threadPriority(5).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).memoryCache(new LruMemoryCache(0x400000)).memoryCacheSize(0x400000).discCache(new UnlimitedDiscCache(file)).discCacheSize(0x3200000).discCacheFileCount(1000).writeDebugLogs().build();
    b = ImageLoader.getInstance();
    b.init(imageloaderconfiguration);
    a = (new com.nostra13.universalimageloader.core.DisplayImageOptions.Builder()).cacheInMemory(true).cacheOnDisc(true).build();
}
 
Example #17
Source File: BaseApplication.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public static void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you may tune some of them, 
    // or you can create default configuration by
    //  ImageLoaderConfiguration.createDefault(this);
    // method.
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .enableLogging() // Not necessary in common
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
 
Example #18
Source File: JieApp.java    From AndJie with GNU General Public License v2.0 5 votes vote down vote up
public static void initImageLoader(Context context) {
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			context).threadPriority(Thread.NORM_PRIORITY - 2)
			.denyCacheImageMultipleSizesInMemory()
			.diskCacheFileNameGenerator(new Md5FileNameGenerator())
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.writeDebugLogs() // Remove for release app
			.build();
	// Initialize ImageLoader with configuration.
	ImageLoader.getInstance().init(config);
}
 
Example #19
Source File: App.java    From Qshp with MIT License 5 votes vote down vote up
public static void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024)).discCacheSize(20 * 1024 * 1024)
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .build();
    ImageLoader.getInstance().init(config);
}
 
Example #20
Source File: BlurImageView.java    From BlurImageView with Apache License 2.0 5 votes vote down vote up
private void initUIL() {
  ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(mContext);
  config.threadPriority(Thread.NORM_PRIORITY - 2);
  config.denyCacheImageMultipleSizesInMemory();
  config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
  config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
  config.tasksProcessingOrder(QueueProcessingType.LIFO);
  config.writeDebugLogs(); // Remove for release app

  // Initialize ImageLoader with configuration.
  ImageLoader.getInstance().init(config.build());
}
 
Example #21
Source File: GithubApplication.java    From WeGit with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    instance = this;
    /**
     * 初始化Talking-data
     */
    new Thread(new Runnable() {
        @Override
        public void run() {
            TCAgent.LOG_ON = false;
            channel = ChannelUtils.getChannel(GithubApplication.this);
            TCAgent.init(GithubApplication.this, TD_APP_ID, channel);
            TCAgent.setReportUncaughtExceptions(true);
        }
    }).start();
    // Initialize ImageLoader with configuration.
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getApplicationContext())
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCacheSize(50 * 1024 * 1024)
                    // 50 Mb
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .writeDebugLogs() // Remove for release app
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example #22
Source File: PhotoUtil.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
public static ImageLoaderConfiguration getImageLoaderConfig(Context context, File cacheDir) {
	return 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();
}
 
Example #23
Source File: CustomApplication.java    From Conquer with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化ImageLoader
 */
public static void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(720, 1280).diskCacheExtraOptions(720, 1280, null)
            .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
            .memoryCache(new WeakMemoryCache()).diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCacheSize(70 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
}
 
Example #24
Source File: GApplication.java    From android-auto-scroll-viewpager with Apache License 2.0 5 votes vote down vote up
/**
 * ImageLoader init.
 *
 * @param context
 */
protected void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.FIFO)
                    //.writeDebugLogs() // Remove for release app
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example #25
Source File: App.java    From RxJavaApp with Apache License 2.0 5 votes vote down vote up
private void initImageLoader(Context context) {

        DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
                //.showImageForEmptyUri(R.drawable.ic_empty)
                //.showImageOnFail(R.drawable.ic_error)
                .resetViewBeforeLoading(true)
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .imageScaleType(ImageScaleType.EXACTLY)
                .bitmapConfig(Bitmap.Config.RGB_565)
                .considerExifParams(true)
                .displayer(new FadeInBitmapDisplayer(300))
                .build();

        // This configuration tuning is custom. You can tune every option, you may tune some of them,
        // or you can create default configuration by
        //  ImageLoaderConfiguration.createDefault(this);
        // method.
        ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
        config.threadPriority(Thread.NORM_PRIORITY - 2);
        config.denyCacheImageMultipleSizesInMemory();
        config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
        config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
        config.tasksProcessingOrder(QueueProcessingType.LIFO);
        config.defaultDisplayImageOptions(defaultOptions);

        // Initialize ImageLoader with configuration.
        ImageLoader.getInstance().init(config.build());

    }
 
Example #26
Source File: AudioStreamerApplication.java    From DMAudioStreamer with Apache License 2.0 5 votes vote down vote up
public static void initImageLoader(Context context) {
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for release app

    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}
 
Example #27
Source File: LemallPlatform.java    From letv with Apache License 2.0 5 votes vote down vote up
private static void initImageLoader(Context context) {
    Builder config = new Builder(context);
    config.threadPoolSize(3);
    config.memoryCache(new WeakMemoryCache());
    config.memoryCacheSize(2097152);
    config.discCacheSize(100);
    config.threadPriority(3);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(ConfigurationBuild.DEFAULT_DEFAULT_SDCARD_SIZE);
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs();
    ImageLoader.getInstance().init(config.build());
}
 
Example #28
Source File: ImageLoaderUtil.java    From sctalk with Apache License 2.0 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 #29
Source File: DemoApplication.java    From JieCaoVideoPlayer-develop with MIT License 5 votes vote down vote up
private void initUniversalImageLoader() {
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(getApplicationContext());
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for releaseAllVideos app
    config.defaultDisplayImageOptions(getDefaultDisplayImageOption());
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}
 
Example #30
Source File: Appliction.java    From CoolWeather with Apache License 2.0 5 votes vote down vote up
private void initImageLoader(Context ctx) {
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
			ctx).threadPriority(Thread.NORM_PRIORITY - 2)
			.denyCacheImageMultipleSizesInMemory()
			.discCacheFileNameGenerator(new Md5FileNameGenerator())
			.tasksProcessingOrder(QueueProcessingType.LIFO)
			.discCacheSize(32 * 1024 * 1024)
			.memoryCacheSize(4 * 1024 * 1024).enableLogging().build();
	ImageLoader.getInstance().init(config);
	
}