com.nostra13.universalimageloader.utils.StorageUtils Java Examples
The following examples show how to use
com.nostra13.universalimageloader.utils.StorageUtils.
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: MyApplication.java From AndroidCacheFoundation with Apache License 2.0 | 6 votes |
/** * Universal Image Loader Setup */ private void setupUIL() { File cacheDir = StorageUtils.getOwnCacheDirectory( getApplicationContext(), "CafeCar/cache"); options = new DisplayImageOptions.Builder() .cacheOnDisc(true).cacheInMemory(true).build(); cache = new TotalSizeLimitedDiscCache(cacheDir, 50 * 1024 * 1024); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( getApplicationContext()).threadPoolSize(3) .threadPriority(Thread.NORM_PRIORITY - 1) .denyCacheImageMultipleSizesInMemory() .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation .discCache(cache) // You can pass your own disc cache implementation .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) .defaultDisplayImageOptions(options).build(); ImageLoader.getInstance().init(config); }
Example #2
Source File: DefaultConfigurationFactory.java From candybar with Apache License 2.0 | 6 votes |
/** * 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 LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount); } catch (IOException e) { L.e(e); // continue and create unlimited cache } } File cacheDir = StorageUtils.getCacheDirectory(context); return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator); }
Example #3
Source File: CustomGalleryActivity.java From MultipleImagePicker with Apache License 2.0 | 6 votes |
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 #4
Source File: DefaultConfigurationFactory.java From WliveTV with Apache License 2.0 | 6 votes |
/** * 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 LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount); } catch (IOException e) { L.e(e); // continue and create unlimited cache } } File cacheDir = StorageUtils.getCacheDirectory(context); return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator); }
Example #5
Source File: App.java From RecyclerView-Animation-Demo with Apache License 2.0 | 6 votes |
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: DefaultConfigurationFactory.java From Android-Universal-Image-Loader-Modify with Apache License 2.0 | 6 votes |
/** * 默认图片 本地路径缓存 * 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 LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount); } catch (IOException e) { L.e(e); // continue and create unlimited cache } } //创建无限制的文件缓存器 File cacheDir = StorageUtils.getCacheDirectory(context); return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator); }
Example #7
Source File: MainApplication.java From snowdream-books-android with Apache License 2.0 | 6 votes |
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 #8
Source File: UniversalImageLoader.java From UltimateAndroid with Apache License 2.0 | 6 votes |
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 #9
Source File: DefaultConfigurationFactory.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
/** * 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 LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount); } catch (IOException e) { L.e(e); // continue and create unlimited cache } } File cacheDir = StorageUtils.getCacheDirectory(context); return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator); }
Example #10
Source File: UniversalImageLoader.java From UltimateAndroid with Apache License 2.0 | 6 votes |
/** * Get default ImageLoaderConfiguration.Builder,and you can easily change the builder. * @param context * @return */ 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 .diskCache(new UnlimitedDiskCache(cacheDir)) // default // .discCacheSize(50 * 1024 * 1024) .diskCacheFileCount(1000) .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default .imageDownloader(new BaseImageDownloader(context)) // default .imageDecoder(new BaseImageDecoder(false)) // default // .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default .defaultDisplayImageOptions(getDefaultImageOptions()); return builder; }
Example #11
Source File: DefaultConfigurationFactory.java From android-open-project-demo with Apache License 2.0 | 6 votes |
/** * 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 #12
Source File: DefaultConfigurationFactory.java From mobile-manager-tool with MIT License | 6 votes |
/** * 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 #13
Source File: HuxianApplication.java From android-open-project-demo with Apache License 2.0 | 6 votes |
@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 #14
Source File: MainApplication.java From android-imageviewer with Apache License 2.0 | 6 votes |
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 #15
Source File: AndroidUniversalImageLoaderSampleApplication.java From android-opensource-library-56 with Apache License 2.0 | 6 votes |
@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 #16
Source File: ApkCache.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
/** * This location is only for caching, do not install directly from this location * because if the file is on the External Storage, any other app could swap out * the APK while the install was in process, allowing malware to install things. * Using {@link Installer#installPackage(Uri, Uri)} * is fine since that does the right thing. */ public static File getApkCacheDir(Context context) { File apkCacheDir = new File(StorageUtils.getCacheDirectory(context, true), CACHE_DIR); if (apkCacheDir.isFile()) { apkCacheDir.delete(); } if (!apkCacheDir.exists()) { apkCacheDir.mkdir(); } return apkCacheDir; }
Example #17
Source File: ImageLoaderHelper.java From SimplifyReader with Apache License 2.0 | 5 votes |
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 #18
Source File: AppApplication.java From AndroidAppCodeFramework with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); File cacheDir = StorageUtils.getCacheDirectory(this); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .discCacheExtraOptions(720, 1024, Bitmap.CompressFormat.PNG, 100, null) .discCache(new UnlimitedDiscCache(cacheDir)) .discCacheSize(50 * 1024 * 1024) .discCacheFileCount(100) .build(); ImageLoader.getInstance().init(config); }
Example #19
Source File: AppApplication.java From AndroidAppCodeFramework with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); File cacheDir = StorageUtils.getCacheDirectory(this); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .discCacheExtraOptions(720, 1024, Bitmap.CompressFormat.PNG, 100, null) .discCache(new UnlimitedDiscCache(cacheDir)) .discCacheSize(50 * 1024 * 1024) .discCacheFileCount(100) .build(); ImageLoader.getInstance().init(config); }
Example #20
Source File: DefaultConfigurationFactory.java From Android-Universal-Image-Loader-Modify with Apache License 2.0 | 5 votes |
/** Creates reserve disk cache folder which will be used if primary disk cache folder becomes unavailable */ private static File createReserveDiskCacheDir(Context context) { File cacheDir = StorageUtils.getCacheDirectory(context, false); File individualDir = new File(cacheDir, "uil-images"); if (individualDir.exists() || individualDir.mkdir()) { cacheDir = individualDir; } return cacheDir; }
Example #21
Source File: DefaultConfigurationFactory.java From android-open-project-demo with Apache License 2.0 | 5 votes |
/** Creates reserve disk cache folder which will be used if primary disk cache folder becomes unavailable */ private static File createReserveDiskCacheDir(Context context) { File cacheDir = StorageUtils.getCacheDirectory(context, false); File individualDir = new File(cacheDir, "uil-images"); if (individualDir.exists() || individualDir.mkdir()) { cacheDir = individualDir; } return cacheDir; }
Example #22
Source File: DefaultConfigurationFactory.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
public static DiskCache createDiskCache(Context context, FileNameGenerator filenamegenerator, long l, int i) { File file = a(context); if (l > 0L || i > 0) { LruDiscCache lrudisccache = new LruDiscCache(StorageUtils.getIndividualCacheDirectory(context), filenamegenerator, l, i); lrudisccache.setReserveCacheDir(file); return lrudisccache; } else { return new UnlimitedDiscCache(StorageUtils.getCacheDirectory(context), file, filenamegenerator); } }
Example #23
Source File: DefaultConfigurationFactory.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
private static File a(Context context) { File file = StorageUtils.getCacheDirectory(context, false); File file1 = new File(file, "uil-images"); if (file1.exists() || file1.mkdir()) { file = file1; } return file; }
Example #24
Source File: DemoApplication.java From LoveTalkClient with Apache License 2.0 | 5 votes |
public static void initImageLoader(Context context) { File cacheDir = StorageUtils.getOwnCacheDirectory(context, "leanchat/Cache"); ImageLoaderConfiguration config = PhotoUtil.getImageLoaderConfig( context, cacheDir); // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config); }
Example #25
Source File: MyApplication.java From zhangshangwuda with Apache License 2.0 | 5 votes |
private void initImageLoader() { DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true).cacheOnDisc(true).build(); File cacheDir = StorageUtils.getCacheDirectory(this); File cacheImg = new File(cacheDir, "IMG"); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( getApplicationContext()) .defaultDisplayImageOptions(defaultOptions) .discCache(new UnlimitedDiscCache(cacheImg)) .discCacheSize(30 * 1024 * 1024) // .writeDebugLogs() .build(); mImageLoader = ImageLoader.getInstance(); mImageLoader.init(config); }
Example #26
Source File: SdCacheTools.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
public static File getOwnAudioCacheDir(Context context) { File imageCache = StorageUtils.getCacheDirectory(context, "WP/audios", true); if (!imageCache.exists()) { imageCache.mkdirs(); } return imageCache; }
Example #27
Source File: DefaultConfigurationFactory.java From candybar with Apache License 2.0 | 5 votes |
/** * Creates reserve disk cache folder which will be used if primary disk cache folder becomes unavailable */ private static File createReserveDiskCacheDir(Context context) { File cacheDir = StorageUtils.getCacheDirectory(context, false); File individualDir = new File(cacheDir, "uil-images"); if (individualDir.exists() || individualDir.mkdir()) { cacheDir = individualDir; } return cacheDir; }
Example #28
Source File: ImageLoaderConfig.java From fitness_Android with Apache License 2.0 | 5 votes |
/** * 异步图片加载ImageLoader的初始化操作,在Application中调用此方法 * * @param context * 上下文对象 * @param cacheDisc * 图片缓存到SDCard的目录,只需要传入SDCard根目录下的子目录即可,默认会建立在SDcard的根目录下 */ public static void initImageLoader(Context context, String cacheDisc) { // 配置ImageLoader // 获取本地缓存的目录,该目录在SDCard的根目录下 File cacheDir = StorageUtils.getOwnCacheDirectory(context, cacheDisc); // 实例化Builder ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder( context); // 设置线程数量 builder.threadPoolSize(3); // 设定线程等级比普通低一点 builder.threadPriority(Thread.NORM_PRIORITY); // 设定内存缓存为弱缓存 builder.memoryCache(new WeakMemoryCache()); // 设定内存图片缓存大小限制,不设置默认为屏幕的宽高 builder.memoryCacheExtraOptions(480, 800); // 设定只保存同一尺寸的图片在内存 builder.denyCacheImageMultipleSizesInMemory(); // 设定缓存的SDcard目录,UnlimitDiscCache速度最快 builder.discCache(new UnlimitedDiscCache(cacheDir)); // 设定缓存到SDCard目录的文件命名 builder.discCacheFileNameGenerator(new HashCodeFileNameGenerator()); // 设定网络连接超时 timeout: 10s 读取网络连接超时read timeout: 60s builder.imageDownloader(new BaseImageDownloader(context, 10000, 60000)); // 设置ImageLoader的配置参数 builder.defaultDisplayImageOptions(initDisplayOptions(true)); // 初始化ImageLoader ImageLoader.getInstance().init(builder.build()); }
Example #29
Source File: DefaultConfigurationFactory.java From letv with Apache License 2.0 | 5 votes |
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 #30
Source File: DefaultConfigurationFactory.java From letv with Apache License 2.0 | 5 votes |
private static File createReserveDiskCacheDir(Context context) { File cacheDir = StorageUtils.getCacheDirectory(context, false); File individualDir = new File(cacheDir, "uil-images"); if (individualDir.exists() || individualDir.mkdir()) { return individualDir; } return cacheDir; }