本文整理汇总了Java中com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache类的典型用法代码示例。如果您正苦于以下问题:Java WeakMemoryCache类的具体用法?Java WeakMemoryCache怎么用?Java WeakMemoryCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WeakMemoryCache类属于com.nostra13.universalimageloader.cache.memory.impl包,在下文中一共展示了WeakMemoryCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/** 初始化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);// 全局初始化此配置
}
示例2: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/**
* ��ʼ��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);// ȫ�ֳ�ʼ��������
}
示例3: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/** 初始化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);// 全局初始化此配置
}
示例4: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/**
* ����loader ��options �� config
* @param context
*/
public static void initImageLoader(Context context) {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.default_face)
.showImageForEmptyUri(R.drawable.default_face)
.showImageOnFail(R.drawable.default_face).cacheInMemory(true)
.considerExifParams(true)
.displayer(new FadeInBitmapDisplayer(300, true, true, true))
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.bitmapConfig(Bitmap.Config.RGB_565).build();
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(
context).defaultDisplayImageOptions(defaultOptions)
.memoryCache(new WeakMemoryCache());
ImageLoaderConfiguration config = builder.build();
ImageLoader.getInstance().init(config);
}
示例5: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/** ��ʼ��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);// ȫ�ֳ�ʼ��������
}
示例6: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
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) {
}
}
示例7: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
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) {
}
}
示例8: onCreate
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.displayer(new FadeInBitmapDisplayer(200, true, false, false))
.imageScaleType(ImageScaleType.EXACTLY) // default
.resetViewBeforeLoading(true)
.considerExifParams(true)
.build();
// Create global configuration and initialize ImageLoader with this configuration
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.memoryCache(new WeakMemoryCache())
.build();
ImageLoader.getInstance().init(config);
}
示例9: iniImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/**
* http://seniorzhai.github.io/2014/10/14/UIL%E5%9B%BE%E7%89%87%E5%BC%82%E6%AD%A5%E5%8A%A0%E8%BD%BD%E5%BA%93%E7%9A%84%E4%BD%BF%E7%94%A8/
* */
private void iniImageLoader()
{
File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(),"doubanonlineimageloader/Cache");
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.offOutOfMemoryHandling()
.discCacheExtraOptions(720, 480, CompressFormat.JPEG, 75)
.discCache(new UnlimitedDiscCache(cacheDir))
.imageDownloader(new URLConnectionImageDownloader(120 * 1000, 120 * 1000))
.enableLogging()
.build();
ImageLoader.getInstance().init(config);
imageLoader = ImageLoader.getInstance();
}
示例10: getStandardOptions
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
private static ImageLoaderConfiguration getStandardOptions(final Context context,
final BitmapProcessor processor) {
final ImageLoaderConfiguration.Builder config =
new ImageLoaderConfiguration.Builder(context);
config.defaultDisplayImageOptions(getProcessorDisplayImageOptions(processor));
config.memoryCache(new WeakMemoryCache());
config.taskExecutor(Executors.newCachedThreadPool());
config.threadPriority(Thread.MIN_PRIORITY);
config.imageDownloader(new OkHttpDownloader(context));
config.writeDebugLogs();
return config.build();
}
示例11: initiImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
private void initiImageLoader() {
DisplayImageOptions options = new DisplayImageOptions.Builder()
.bitmapConfig(Bitmap.Config.RGB_565)
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisc(true)
.displayer(new FadeInBitmapDisplayer(200))
.showImageOnLoading(R.drawable.ic_launcher)
.build();
File cacheDir;
if(Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED){
cacheDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
}else{
cacheDir = getCacheDir();
}
ImageLoaderConfiguration.Builder configBuilder = new ImageLoaderConfiguration.Builder(mContext)
.threadPoolSize(2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.discCache(new UnlimitedDiscCache(cacheDir))
.defaultDisplayImageOptions(options);
if(BuildConfig.DEBUG){
configBuilder.writeDebugLogs();
}
ImageLoader.getInstance().init(configBuilder.build());
}
示例12: onCreate
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheOnDisk(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.diskCacheFileCount(300)
.threadPoolSize(5)
.memoryCache(new WeakMemoryCache())
.build();
ImageLoader.getInstance().init(config);
}
示例13: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
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());
}
示例14: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
private void initImageLoader() {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.imageScaleType(ImageScaleType.NONE)
.cacheOnDisk(true).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.defaultDisplayImageOptions(defaultOptions)
.tasksProcessingOrder(QueueProcessingType.LIFO)
.memoryCache(new WeakMemoryCache())
.threadPoolSize(5)
.build();
ImageLoader.getInstance().init(config);
}
示例15: initImageLoader
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; //导入依赖的package包/类
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context,
Constant.CACHE_DIR_IMAGE );// 获取到缓存的目录地址
Log.d("cacheDir"+ cacheDir.getPath() );
// 创建配置ImageLoader(所有的选项都是可选的,只使用那些你真的想定制),这个可以设定在APPLACATION里面,设置为全局的配置参数
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
// 线程池内加载的数量
.threadPoolSize(3)
.threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
/***新增*** /
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13) // default
/***新增end***/
.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);// 全局初始化此配置
}