com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache Java Examples
The following examples show how to use
com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache.
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: ImageLoaderManager.java From Focus with GNU General Public License v3.0 | 6 votes |
public static void init(Context context) { ColorDrawable defaultDrawable = new ColorDrawable(context.getResources().getColor(R.color.main_grey_light)); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(defaultDrawable) .showImageForEmptyUri(defaultDrawable) .showImageOnFail(defaultDrawable) .cacheInMemory(true) .cacheOnDisk(true) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(options) .memoryCache(new LruMemoryCache(8 * 1024 * 1024)) .diskCacheSize(100 * 1024 * 1024) .diskCacheFileCount(100) .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); }
Example #2
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 #3
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 #4
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 #5
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 #6
Source File: ApngImageLoader.java From apng-view with Apache License 2.0 | 6 votes |
private ImageLoaderConfiguration getDefaultApngComponentImageLoaderConfiguration(Context context) { DisplayImageOptions defaultDisplayImageOptions = new DisplayImageOptions.Builder() .cacheInMemory(false) .cacheOnDisk(true) .build(); return new ImageLoaderConfiguration.Builder(context) .memoryCache(new LruMemoryCache(2 * 1024 * 1024)) .memoryCacheSize(2 * 1024 * 1024) .diskCacheSize(50 * 1024 * 1024) .diskCacheFileCount(100) .imageDownloader(new ApngImageDownloader(context)) .defaultDisplayImageOptions(defaultDisplayImageOptions) .build(); }
Example #7
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 #8
Source File: ImageLoaderManager.java From Focus with GNU General Public License v3.0 | 6 votes |
public static void init(Context context) { ColorDrawable defaultDrawable = new ColorDrawable(context.getResources().getColor(R.color.main_grey_light)); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(defaultDrawable) .showImageForEmptyUri(defaultDrawable) .showImageOnFail(defaultDrawable) .cacheInMemory(true) .cacheOnDisk(true) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(options) .memoryCache(new LruMemoryCache(8 * 1024 * 1024)) .diskCacheSize(100 * 1024 * 1024) .diskCacheFileCount(100) .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); }
Example #9
Source File: LetvCacheConfiguration.java From letv with Apache License 2.0 | 6 votes |
public static LruMemoryCache getMemoryCache(Context context) { int cacheSize = 4194304; try { int i; int memClass = ((ActivityManager) context.getSystemService("activity")).getMemoryClass(); int availableSize = memClass >> 3; if (availableSize == 0) { i = 4; } else { i = availableSize; } cacheSize = 1048576 * i; Log.d("ljn", "getMemoryCache---memClass:" + memClass + "----availableSize:" + availableSize); } catch (Exception exception) { exception.printStackTrace(); } return new LruMemoryCache(cacheSize); }
Example #10
Source File: BaseApplication.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
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 #11
Source File: DefaultConfigurationFactory.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
/** * Creates default implementation of {@link MemoryCache} - {@link LruMemoryCache}<br /> * Default cache size = 1/8 of available app memory. */ public static MemoryCache createMemoryCache(Context context, int memoryCacheSize) { if (memoryCacheSize == 0) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); int memoryClass = am.getMemoryClass(); if (hasHoneycomb() && isLargeHeap(context)) { memoryClass = getLargeMemoryClass(am); } memoryCacheSize = 1024 * 1024 * memoryClass / 8; } return new LruMemoryCache(memoryCacheSize); }
Example #12
Source File: DefaultConfigurationFactory.java From candybar with Apache License 2.0 | 5 votes |
/** * Creates default implementation of {@link MemoryCache} - {@link LruMemoryCache}<br /> * Default cache size = 1/8 of available app memory. */ public static MemoryCache createMemoryCache(Context context, int memoryCacheSize) { if (memoryCacheSize == 0) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); int memoryClass = am.getMemoryClass(); if (hasHoneycomb() && isLargeHeap(context)) { memoryClass = getLargeMemoryClass(am); } memoryCacheSize = 1024 * 1024 * memoryClass / 8; } return new LruMemoryCache(memoryCacheSize); }
Example #13
Source File: DefaultConfigurationFactory.java From android-open-project-demo with Apache License 2.0 | 5 votes |
/** * Creates default implementation of {@link MemoryCache} - {@link LruMemoryCache}<br /> * Default cache size = 1/8 of available app memory. */ public static MemoryCache createMemoryCache(int memoryCacheSize) { if (memoryCacheSize == 0) { memoryCacheSize = (int) (Runtime.getRuntime().maxMemory() / 8); } return new LruMemoryCache(memoryCacheSize); }
Example #14
Source File: App.java From Qshp with MIT License | 5 votes |
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 #15
Source File: ApngImageLoader.java From apng-view with Apache License 2.0 | 5 votes |
private ImageLoaderConfiguration getDefaultCommonImageLoaderConfiguration() { return new ImageLoaderConfiguration.Builder(this.context) .memoryCache(new LruMemoryCache(8 * 1024 * 1024)) .memoryCacheSize(8 * 1024 * 1024) .diskCacheSize(50 * 1024 * 1024) .diskCacheFileCount(100) .build(); }
Example #16
Source File: DefaultConfigurationFactory.java From mobile-manager-tool with MIT License | 5 votes |
/** * Creates default implementation of {@link MemoryCache} - {@link com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache}<br /> * Default cache size = 1/8 of available app memory. */ public static MemoryCache createMemoryCache(int memoryCacheSize) { if (memoryCacheSize == 0) { memoryCacheSize = (int) (Runtime.getRuntime().maxMemory() / 8); } return new LruMemoryCache(memoryCacheSize); }
Example #17
Source File: DefaultConfigurationFactory.java From Android-Universal-Image-Loader-Modify with Apache License 2.0 | 5 votes |
/** * 默认图片缓存器 采用LruMemoryCache * Creates default implementation of {@link MemoryCache} - {@link LruMemoryCache}<br /> * Default cache size = 1/8 of available app memory. */ public static MemoryCache createMemoryCache(Context context, int memoryCacheSize) { if (memoryCacheSize == 0) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); int memoryClass = am.getMemoryClass(); if (hasHoneycomb() && isLargeHeap(context)) { memoryClass = getLargeMemoryClass(am); } memoryCacheSize = 1024 * 1024 * memoryClass / 8; } return new LruMemoryCache(memoryCacheSize); }
Example #18
Source File: ImageLoadProxy.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public static void initImageLoader(Context context) { ImageLoaderConfiguration.Builder build = new ImageLoaderConfiguration.Builder(context); build.tasksProcessingOrder(QueueProcessingType.LIFO); build.diskCacheSize(MAX_DISK_CACHE); build.memoryCacheSize(MAX_MEMORY_CACHE); build.memoryCache(new LruMemoryCache(MAX_MEMORY_CACHE)); if (BuildConfig.DEBUG && isShowLog) { build.writeDebugLogs(); } getImageLoader().init(build.build()); }
Example #19
Source File: BraceletImageLoader.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
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 #20
Source File: DefaultConfigurationFactory.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
public static MemoryCache createMemoryCache(int i) { if (i == 0) { i = (int)(Runtime.getRuntime().maxMemory() / 8L); } return new LruMemoryCache(i); }
Example #21
Source File: ImageLoadProxy.java From JianDanRxJava with Apache License 2.0 | 5 votes |
public static void initImageLoader(Context context) { ImageLoaderConfiguration.Builder build = new ImageLoaderConfiguration.Builder(context); build.tasksProcessingOrder(QueueProcessingType.LIFO); build.diskCacheSize(MAX_DISK_CACHE); build.memoryCacheSize(MAX_MEMORY_CACHE); build.memoryCache(new LruMemoryCache(MAX_MEMORY_CACHE)); if (BuildConfig.DEBUG && isShowLog) { build.writeDebugLogs(); } getImageLoader().init(build.build()); }
Example #22
Source File: ImageLoadProxy.java From JianDan with Apache License 2.0 | 5 votes |
public static void initImageLoader(Context context) { ImageLoaderConfiguration.Builder build = new ImageLoaderConfiguration.Builder(context); build.tasksProcessingOrder(QueueProcessingType.LIFO); build.diskCacheSize(MAX_DISK_CACHE); build.memoryCacheSize(MAX_MEMORY_CACHE); build.memoryCache(new LruMemoryCache(MAX_MEMORY_CACHE)); if (BuildConfig.DEBUG && isShowLog) { build.writeDebugLogs(); } getImageLoader().init(build.build()); }
Example #23
Source File: ImageLoadProxy.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public static void initImageLoader(Context context) { ImageLoaderConfiguration.Builder build = new ImageLoaderConfiguration.Builder(context); build.tasksProcessingOrder(QueueProcessingType.LIFO); build.diskCacheSize(MAX_DISK_CACHE); build.memoryCacheSize(MAX_MEMORY_CACHE); build.memoryCache(new LruMemoryCache(MAX_MEMORY_CACHE)); if (BuildConfig.DEBUG && isShowLog) { build.writeDebugLogs(); } getImageLoader().init(build.build()); }
Example #24
Source File: DefaultConfigurationFactory.java From WliveTV with Apache License 2.0 | 5 votes |
/** * Creates default implementation of {@link MemoryCache} - {@link LruMemoryCache}<br /> * Default cache size = 1/8 of available app memory. */ public static MemoryCache createMemoryCache(Context context, int memoryCacheSize) { if (memoryCacheSize == 0) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); int memoryClass = am.getMemoryClass(); if (hasHoneycomb() && isLargeHeap(context)) { memoryClass = getLargeMemoryClass(am); } memoryCacheSize = 1024 * 1024 * memoryClass / 8; } return new LruMemoryCache(memoryCacheSize); }
Example #25
Source File: ImageLoaderSetting.java From Pas with Apache License 2.0 | 4 votes |
public static void initImageLoader(Context context) { // 设置缓存 路径 File cacheDir = StorageUtils.getOwnCacheDirectory(context, "eh2h/imageloader/Cache"); //默认 defaultOptions = new DisplayImageOptions.Builder() .showImageOnLoading(R.mipmap.ic_launcher) .showImageForEmptyUri(R.mipmap.ic_launcher) .showImageOnFail(R.mipmap.ic_launcher) .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default //.displayer(new FadeInBitmapDisplayer(300, true, true, true)) //.displayer(new RoundedBitmapDisplayer(90)) .delayBeforeLoading(100)//载入图片前稍做延时可以提高整体滑动的流畅度 .bitmapConfig(Bitmap.Config.RGB_565).build(); animateFirstListener = new AnimateFirstDisplayListener(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .memoryCacheExtraOptions(480, 800) // default = device screen dimensions .diskCacheExtraOptions(480, 800, null) .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 .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default // .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); }
Example #26
Source File: ImageLoaderSetting.java From Pas with Apache License 2.0 | 4 votes |
public static void initImageLoader(Context context) { // 设置缓存 路径 File cacheDir = StorageUtils.getOwnCacheDirectory(context, "eh2h/imageloader/Cache"); //默认 defaultOptions = new DisplayImageOptions.Builder() .showImageOnLoading(R.mipmap.defaultbg) .showImageForEmptyUri(R.mipmap.defaultbg) .showImageOnFail(R.mipmap.defaultbg) .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default //.displayer(new FadeInBitmapDisplayer(300, true, true, true)) //.displayer(new RoundedBitmapDisplayer(90)) .delayBeforeLoading(100)//载入图片前稍做延时可以提高整体滑动的流畅度 .bitmapConfig(Bitmap.Config.RGB_565).build(); animateFirstListener = new AnimateFirstDisplayListener(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .memoryCacheExtraOptions(480, 800) // default = device screen dimensions .diskCacheExtraOptions(480, 800, null) .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 .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default // .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); }
Example #27
Source File: DefaultConfigurationFactory.java From letv with Apache License 2.0 | 4 votes |
public static MemoryCache createMemoryCache(int memoryCacheSize) { if (memoryCacheSize == 0) { memoryCacheSize = (int) (Runtime.getRuntime().maxMemory() / 8); } return new LruMemoryCache(memoryCacheSize); }