com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiscCache Java Examples
The following examples show how to use
com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiscCache.
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: 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 #2
Source File: MainActivity.java From MutiPhotoChoser with Mozilla Public License 2.0 | 6 votes |
private void initImageLoader() { if (!ImageLoader.getInstance().isInited()) { DisplayImageOptions.Builder displayBuilder = new DisplayImageOptions.Builder(); displayBuilder.cacheInMemory(true); displayBuilder.cacheOnDisk(true); displayBuilder.showImageOnLoading(com.ns.mutiphotochoser.R.drawable.default_photo); displayBuilder.showImageForEmptyUri(com.ns.mutiphotochoser.R.drawable.default_photo); displayBuilder.considerExifParams(true); displayBuilder.bitmapConfig(Bitmap.Config.RGB_565); displayBuilder.imageScaleType(ImageScaleType.EXACTLY); displayBuilder.displayer(new FadeInBitmapDisplayer(300)); ImageLoaderConfiguration.Builder loaderBuilder = new ImageLoaderConfiguration.Builder(getApplication()); loaderBuilder.defaultDisplayImageOptions(displayBuilder.build()); loaderBuilder.memoryCacheSize(getMemoryCacheSize()); try { File cacheDir = new File(getExternalCacheDir() + File.separator + CacheConstant.IMAGE_CACHE_DIRECTORY); loaderBuilder.diskCache(new LruDiscCache(cacheDir, DefaultConfigurationFactory.createFileNameGenerator(), 500 * 1024 * 1024)); } catch (IOException e) { e.printStackTrace(); } ImageLoader.getInstance().init(loaderBuilder.build()); } }
Example #3
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 #4
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 #5
Source File: GalleryActivity.java From MutiPhotoChoser with Mozilla Public License 2.0 | 5 votes |
private void initImageLoader() { if (options == null) { DisplayImageOptions.Builder displayBuilder = new DisplayImageOptions.Builder(); displayBuilder.cacheInMemory(true); displayBuilder.cacheOnDisk(true); displayBuilder.showImageOnLoading(R.drawable.default_photo); displayBuilder.showImageForEmptyUri(R.drawable.default_photo); displayBuilder.considerExifParams(true); displayBuilder.bitmapConfig(Bitmap.Config.RGB_565); displayBuilder.imageScaleType(ImageScaleType.EXACTLY); displayBuilder.displayer(new FadeInBitmapDisplayer(300)); options = displayBuilder.build(); } if (!ImageLoader.getInstance().isInited()) { ImageLoaderConfiguration.Builder loaderBuilder = new ImageLoaderConfiguration.Builder(getApplication()); loaderBuilder.memoryCacheSize(getMemoryCacheSize()); try { File cacheDir = new File(getExternalCacheDir() + File.separator + CacheConstant.IMAGE_CACHE_DIRECTORY); loaderBuilder.diskCache(new LruDiscCache(cacheDir, DefaultConfigurationFactory.createFileNameGenerator(), 500 * 1024 * 1024)); } catch (IOException e) { e.printStackTrace(); } ImageLoader.getInstance().init(loaderBuilder.build()); } }
Example #6
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); } }