当前位置: 首页>>代码示例>>Java>>正文


Java StorageUtils类代码示例

本文整理汇总了Java中com.nostra13.universalimageloader.utils.StorageUtils的典型用法代码示例。如果您正苦于以下问题:Java StorageUtils类的具体用法?Java StorageUtils怎么用?Java StorageUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StorageUtils类属于com.nostra13.universalimageloader.utils包,在下文中一共展示了StorageUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDiskCache

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:DefaultConfigurationFactory.java

示例2: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
public void initImageLoader() {
        File cacheDir = StorageUtils.getCacheDirectory(this);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .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)
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
 
开发者ID:rsetkus,项目名称:rx-twitter-stream-android,代码行数:18,代码来源:RxTwitterApplication.java

示例3: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
/**
 * 初始化图片载入框架
 */
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);
}
 
开发者ID:viseator,项目名称:MontageCam,代码行数:28,代码来源:BaseActivity.java

示例4: getDefaultConfig

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
private ImageLoaderConfiguration getDefaultConfig() throws IOException {
    int MAX_CACHE_MEMORY_SIZE = (int) (Runtime.getRuntime().maxMemory() / 8);
    File cacheDir = StorageUtils.getOwnCacheDirectory(context, context.getPackageName() + "/cache/image/");

    LogUtil.i(TAG, "ImageLoader memory cache size = " + MAX_CACHE_MEMORY_SIZE / M + "M");
    LogUtil.i(TAG, "ImageLoader disk cache directory = " + cacheDir.getAbsolutePath());

    ImageLoaderConfiguration config = new ImageLoaderConfiguration
            .Builder(context)
            .threadPoolSize(3) // 线程池内加载的数量
            .threadPriority(Thread.NORM_PRIORITY - 2) // 降低线程的优先级,减小对UI主线程的影响
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAX_CACHE_MEMORY_SIZE))
            .discCache(new LruDiskCache(cacheDir, new Md5FileNameGenerator(), 0))
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
            .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
            .writeDebugLogs()
            .build();

    return config;
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:22,代码来源:ImageLoaderKit.java

示例5: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
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);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:20,代码来源:DemoApplication.java

示例6: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
/**
     * 初始化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);
    }
 
开发者ID:291700351,项目名称:WeCharEnglish,代码行数:31,代码来源:WeCharApplication.java

示例7: onCreate

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
@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);
	}
 
开发者ID:CKTim,项目名称:MyApplication,代码行数:26,代码来源:MyApplication.java

示例8: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
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);
}
 
开发者ID:boliu-mobile,项目名称:SmartFace,代码行数:20,代码来源:App.java

示例9: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的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);// 全局初始化此配置
}
 
开发者ID:HuTianQi,项目名称:YingBeautyNote,代码行数:23,代码来源:BaseApplication.java

示例10: cache

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
public static File cache(String name){
		File cacheDir=null;
		if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){

			String path="/storage/sdcard1";
//			String name="zhai/Cache";//你要新建的文件夹名或者文件名
			cacheDir=new File(path,name);//方法1和方法2的区别在于此
			boolean is=cacheDir.exists();//判断文件(夹)是否存在
			if(!is){
				cacheDir.mkdir();//创建文件夹
			}
			//存储在外置sd卡中
		}else{
			cacheDir=StorageUtils.getOwnCacheDirectory(getApp(),name);
		}
		return cacheDir;
	}
 
开发者ID:konglinghai123,项目名称:zhai,代码行数:18,代码来源:AppApplication.java

示例11: createDiskCache

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:20,代码来源:DefaultConfigurationFactory.java

示例12: onCreate

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
@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);
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:20,代码来源:HuxianApplication.java

示例13: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的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);// ȫ�ֳ�ʼ��������
}
 
开发者ID:JasonGaoH,项目名称:enjoychat,代码行数:26,代码来源:CustomApplication.java

示例14: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的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);// 全局初始化此配置
}
 
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:22,代码来源:CustomApplcation.java

示例15: initImageLoader

import com.nostra13.universalimageloader.utils.StorageUtils; //导入依赖的package包/类
/**
 * 初始化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);
}
 
开发者ID:congwiny,项目名称:MyAndroidTest,代码行数:27,代码来源:BaseApp.java


注:本文中的com.nostra13.universalimageloader.utils.StorageUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。