@SuppressWarnings("deprecation") private void initImageLoader() { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( this) .memoryCacheExtraOptions(480, 800) // default = device screen dimensions .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 .discCacheSize(50 * 1024 * 1024) // 缓冲大小 .discCacheFileCount(100) // 缓冲文件数目 .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default .imageDownloader(new BaseImageDownloader(this)) // default .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default .writeDebugLogs().build(); // 2.单例ImageLoader类的初始化 ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.init(config); }
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()); }
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); }
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.discCacheFileNameGenerator(new Md5FileNameGenerator()); config.discCacheSize(50 * 1024 * 1024); // 50 MiB config.tasksProcessingOrder(QueueProcessingType.LIFO); config.writeDebugLogs(); // Remove for release app // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config.build()); }
/** * 初始化imageloader,请在application中调用此方法 */ public static void initImageLoader(Context context) { // File cacheDir = StorageUtils.getOwnCacheDirectory(context, // "AppDir/cache/images"); File cacheDir = new File(context.getCacheDir(), "images/cache/"); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( context).threadPriority(Thread.NORM_PRIORITY - 2) //降低线程的优先级保证主UI线程不受太大影响 .denyCacheImageMultipleSizesInMemory() .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //图片名称使用md5加密 .tasksProcessingOrder(QueueProcessingType.LIFO) .diskCacheSize(1024 * 1024 * 50) // 硬盘存储缓存大小 .memoryCache(new LruMemoryCache(10 * 1024 * 1024)) //内存缓存 .memoryCacheSize(10 * 1024 * 1024)//内存缓存 .diskCache(new UnlimitedDiskCache(cacheDir)) .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s) .taskExecutor(taskExecutor) .taskExecutorForCachedImages(executorForCachedImages) .threadPriority(Thread.NORM_PRIORITY - 1) .writeDebugLogs() .build(); com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config); }
/** * 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); }
/** * 初始化图片载入框架 */ private void initImageLoader() { File cacheDir = StorageUtils.getCacheDirectory(this); int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory()); // System.out.println("dsa-->"+MAXMEMONRY+" "+(MAXMEMONRY/5));//.memoryCache(new // LruMemoryCache(50 * 1024 * 1024)) DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( this).memoryCacheExtraOptions(480, 800).defaultDisplayImageOptions(defaultOptions) .diskCacheExtraOptions(480, 800, null).threadPoolSize(3) .threadPriority(Thread.NORM_PRIORITY - 2) .tasksProcessingOrder(QueueProcessingType.FIFO) .denyCacheImageMultipleSizesInMemory() .memoryCache(new LruMemoryCache(MAXMEMONRY / 5)) .diskCache(new UnlimitedDiskCache(cacheDir)) .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default .imageDownloader(new BaseImageDownloader(this)) // default .imageDecoder(new BaseImageDecoder(false)) // default .defaultDisplayImageOptions(DisplayImageOptions.createSimple()).build(); ImageLoader.getInstance().init(config); }
private void initImageLoader() { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this) .threadPoolSize(5) .threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .memoryCache(new LruMemoryCache(2 * 1024)) .memoryCacheSize(2 * 1024) .defaultDisplayImageOptions(new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.no_photo_group) .showImageOnFail(R.drawable.no_photo_group) .resetViewBeforeLoading(true) .displayer(new FadeInBitmapDisplayer(300)).build()) .tasksProcessingOrder(QueueProcessingType.LIFO).build(); ImageLoader.getInstance().init(config); com.nostra13.universalimageloader.utils.L.writeLogs(false); }
public static void initImageLoader(Context context) { b = new DisplayImageOptions.Builder(); b.cacheOnDisc(true) .cacheInMemory(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565); ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); config.threadPriority(Thread.NORM_PRIORITY - 2); config.denyCacheImageMultipleSizesInMemory(); config.discCacheFileNameGenerator(new Md5FileNameGenerator()); config.memoryCacheSize(20 * 1024 * 1024); // 20 MiB config.discCacheSize(100 * 1024 * 1024); // 100 MiB config.tasksProcessingOrder(QueueProcessingType.LIFO); config.defaultDisplayImageOptions(b.build()); config.writeDebugLogs(); ImageLoader.getInstance().init(config.build()); }
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 UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(this, Constant.APP_IMAGE))) .diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO) .memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024) .threadPoolSize(3) .build(); ImageLoader.getInstance().init(config); }
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()); }
/** * 初始化ImageLoader * * @param context 上下文对象 */ private void initImageLoader(Context context) { File cacheDir = StorageUtils.getCacheDirectory(context); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .memoryCacheExtraOptions(480, 800) // default = device screen dimensions .diskCacheExtraOptions(480, 800, null) // .taskExecutor(...) // .taskExecutorForCachedImages(...) .threadPoolSize(3) // default .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 UnlimitedDiskCache(cacheDir)) // default .diskCacheSize(50 * 1024 * 1024) .diskCacheFileCount(100) .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default .imageDownloader(new BaseImageDownloader(context)) // default // .imageDecoder(new BaseImageDecoder()) // default .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); }
/** * 初始化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); }
@Override public void onCreate() { super.onCreate(); //初始化ImageLoader // ImageLoaderConfiguration configuration=ImageLoaderConfiguration.createDefault(getApplicationContext()); // ImageLoader.getInstance().init(configuration); File cacheDir = StorageUtils.getOwnCacheDirectory(this, "Hungry and hurry/Cache"); ImageLoaderConfiguration config = new ImageLoaderConfiguration .Builder(this) .memoryCacheExtraOptions(480, 800) // maxwidth, max height,即保存的每个缓存文件的最大长宽 .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) .tasksProcessingOrder(QueueProcessingType.LIFO) .diskCache(new UnlimitedDiskCache(cacheDir))//自定义缓存路径 .diskCacheFileCount(70) .diskCacheFileNameGenerator(new Md5FileNameGenerator())//将保存的时候的URI名称用MD5 加密 .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) .imageDownloader(new BaseImageDownloader(this,5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间 .writeDebugLogs() // Remove for releaseapp .build();//开始构建 ImageLoader.getInstance().init(config); }
public static void initImageLoader(Context context) { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .memoryCacheExtraOptions(480, 800) // default = device screen dimensions .diskCacheExtraOptions(480, 800, null) .tasksProcessingOrder(QueueProcessingType.FIFO) // default .denyCacheImageMultipleSizesInMemory() .memoryCache(new LruMemoryCache(2 * 1024 * 1024)) .memoryCacheSize(2 * 1024 * 1024) .memoryCacheSizePercentage(13) // default .diskCacheSize(50 * 1024 * 1024) .diskCacheFileCount(100) .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default .imageDownloader(new BaseImageDownloader(context)) // default .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default .writeDebugLogs() .build(); // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config); }
private void init(Context context) { imageLoaderconfig = new ImageLoaderConfiguration.Builder( context) .memoryCacheExtraOptions(720, 1280) .threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .diskCacheFileNameGenerator(new Md5FileNameGenerator()) .diskCacheSize(50 * 1024 * 1024) // 50 Mb .tasksProcessingOrder(QueueProcessingType.LIFO) .build(); if (!_imageLoader.isInited()) _imageLoader.init(imageLoaderconfig); }
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 UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(this, AppConstants.APP_IMAGE))) .diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO) .memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024) .threadPoolSize(3) .build(); ImageLoader.getInstance().init(config); }
/** * 初始化 * * @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(); }
public static void init(Context context) { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .discCacheFileNameGenerator(new Md5FileNameGenerator()) .tasksProcessingOrder(QueueProcessingType.LIFO) .build(); ImageLoader.getInstance().init(config); sOptions = new DisplayImageOptions.Builder() // .showImageOnLoading(R.drawable.ic_launcher) //设置图片在下载期间显示的图片 // .showImageForEmptyUri(R.drawable.ic_launcher)//设置图片Uri为空或是错误的时候显示的图片 // .showImageOnFail(R.drawable.ic_launcher) //设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true)//设置下载的图片是否缓存在内存中 // .cacheOnDisc(true)//设置下载的图片是否缓存在SD卡中 .considerExifParams(true) //是否考虑JPEG图像EXIF参数(旋转,翻转) // .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)//设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565)//设置图片的解码类型// // .decodingOptions(android.graphics.BitmapFactory.Options decodingOptions)//设置图片的解码配置 //.delayBeforeLoading(int delayInMillis)//int delayInMillis为你设置的下载前的延迟时间 //设置图片加入缓存前,对bitmap进行设置 //.preProcessor(BitmapProcessor preProcessor) // .resetViewBeforeLoading(true)//设置图片在下载前是否重置,复位 // .displayer(new RoundedBitmapDisplayer(20))//是否设置为圆角,弧度为多少 // .displayer(new FadeInBitmapDisplayer(100))//是否图片加载好后渐入的动画时间 .build();//构建完成 }
/** 初始化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);// 全局初始化此配置 }
@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); }
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(); } }
/** * ��ʼ��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);// ȫ�ֳ�ʼ�������� }
/** * Initialize Imageloader component defining the max size * * @param diskCacheSize in mb */ protected void initImageLoader(int diskCacheSize) { if (diskCacheSize <= 0) { diskCacheSize = 20; } // 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(this) .threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .diskCacheFileNameGenerator(new Md5FileNameGenerator()) .diskCacheSize(diskCacheSize * 1024 * 1024) // 20 Mb .tasksProcessingOrder(QueueProcessingType.LIFO) .build(); // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config); }
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); }
public void initEbConfig(String type) { Log4jLog.i(LONG_TAG, "initEbConfig start, type=" + type); CrashHandler crashHandler = CrashHandler.getInstance(); crashHandler.init(getApplicationContext()); Log4jLog.i(LONG_TAG, "initEbConfig 1"); Entboost.setServiceListener(crashHandler); Log4jLog.i(LONG_TAG, "initEbConfig 2"); Entboost.init(getApplicationContext()); Log4jLog.i(LONG_TAG, "initEbConfig 3"); Entboost.showSotpLog(false); Log4jLog.i(LONG_TAG, "initEbConfig 4"); Builder imgConfig = new ImageLoaderConfiguration.Builder(this); imgConfig.threadPriority(Thread.NORM_PRIORITY - 2);// 设置线程的优先级 imgConfig.diskCacheFileNameGenerator(new Md5FileNameGenerator());// 设置缓存文件的名字 imgConfig.diskCacheSize(50 * 1024 * 1024); // 50 MiB imgConfig.denyCacheImageMultipleSizesInMemory();// 当同一个Uri获取不同大小的图片,缓存到内存时,只缓存一个。默认会缓存多个不同的大小的相同图片 imgConfig.tasksProcessingOrder(QueueProcessingType.LIFO);// 设置图片下载和显示的工作队列排序 ImageLoader.getInstance().init(imgConfig.build()); defaultImgOptions = createImgOptions(R.drawable.entboost_logo, R.drawable.entboost_logo, R.drawable.entboost_logo); userImgOptions = createImgOptions(0, R.drawable.default_user, R.drawable.default_user); funcInfoImgOptions = createImgOptions(0, R.drawable.default_app, R.drawable.default_app); }
/** 初始化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);// 全局初始化此配置 }
/** * 初始化 UIL图片加载框架 */ private void initImageLoader() { ImageLoaderConfiguration imageLoaderConfig = new ImageLoaderConfiguration.Builder(getApplicationContext()) // 对于同一张图片有多种尺寸的图, 只存储其中一个 .denyCacheImageMultipleSizesInMemory() // 内存缓存使用 LRU 算法进行存储和删除, 容量10MB .memoryCache(new LruMemoryCache(10 * 1024 * 1024)) // 硬盘缓存容量 50MB .diskCacheSize(50 * 1024 * 1024) // 硬盘上缓存的图片名称是经过使用 md5 转换后的名称. .diskCacheFileNameGenerator(new Md5FileNameGenerator()) // 线程池按照LIFO的顺序进行图片的加载, 即: 越是后加入到线程池队列中的图片, 越是优先进行加载. .tasksProcessingOrder(QueueProcessingType.LIFO) // 设置线程池最大并发数为5 .threadPoolSize(5) // 打开调试日志的开关 .writeDebugLogs() .build(); ImageLoader.getInstance().init(imageLoaderConfig); }
private void initImageLoader(Context context) { ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); config.denyCacheImageMultipleSizesInMemory(); config.diskCacheSize(50 * 1024 * 1024); config.tasksProcessingOrder(QueueProcessingType.LIFO); ImageLoader.getInstance().init(config.build()); defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(false) .cacheOnDisk(true) .imageScaleType(ImageScaleType.IN_SAMPLE_INT)//设置图片以如何的编码方式显示 .showImageOnLoading(R.mipmap.loading) .bitmapConfig(Bitmap.Config.RGB_565) .showImageOnFail(R.mipmap.loading) .showImageForEmptyUri(R.mipmap.loading) .build(); ImageLoader.getInstance().clearDiskCache(); ImageLoader.getInstance().clearMemoryCache(); }
/** * 初始化imageloader */ private void initImageLoader() { File cacheDir = StorageUtils.getOwnCacheDirectory( getApplicationContext(), "imageloader/Cache"); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( this) .threadPoolSize(3) // default .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 UnlimitedDiskCache(cacheDir)) // default .diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100) .diskCacheFileNameGenerator(new Md5FileNameGenerator()) // default .defaultDisplayImageOptions(ImageLoaderHelper.getInstance(this).getDisplayOptions()) // default .writeDebugLogs().build(); ImageLoader.getInstance().init(config); }
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()); }
/** ��ʼ��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);// ȫ�ֳ�ʼ�������� }
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()); }