當前位置: 首頁>>代碼示例>>Java>>正文


Java UnlimitedDiskCache類代碼示例

本文整理匯總了Java中com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache的典型用法代碼示例。如果您正苦於以下問題:Java UnlimitedDiskCache類的具體用法?Java UnlimitedDiskCache怎麽用?Java UnlimitedDiskCache使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnlimitedDiskCache類屬於com.nostra13.universalimageloader.cache.disc.impl包,在下文中一共展示了UnlimitedDiskCache類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDiskCache

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
/**
     * 初始化imageloader,請在application中調用此方法
     */
    public static void initImageLoader(Context context) {
//        File cacheDir = StorageUtils.getOwnCacheDirectory(context,
//                "AppDir/cache/images");
        File cacheDir = new File(context.getCacheDir(), "images/cache/");
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context).threadPriority(Thread.NORM_PRIORITY - 2) //降低線程的優先級保證主UI線程不受太大影響
                .denyCacheImageMultipleSizesInMemory()
                .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //圖片名稱使用md5加密
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .diskCacheSize(1024 * 1024 * 50) // 硬盤存儲緩存大小
                .memoryCache(new LruMemoryCache(10 * 1024 * 1024)) //內存緩存
                .memoryCacheSize(10 * 1024 * 1024)//內存緩存
                .diskCache(new UnlimitedDiskCache(cacheDir))
                .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)
                .taskExecutor(taskExecutor)
                .taskExecutorForCachedImages(executorForCachedImages)
                .threadPriority(Thread.NORM_PRIORITY - 1)
                .writeDebugLogs()
                .build();
        com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);
    }
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:25,代碼來源:ImageLoaderUtils.java

示例4: initImageLoader

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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

示例5: initImageLoader

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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

示例6: onCreate

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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

示例7: ImageUtil

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
private ImageUtil(Context ctx) {
        this.context = ctx;
        threadPool = Executors.newFixedThreadPool(5);

        this.preferences = PreferenceManager.getDefaultSharedPreferences(ctx);
        provider = ImageServiceProvider.values()[preferences.getInt(PREFERENCE_PROVIDER, ImageServiceProvider.GLIDE.ordinal())];

        Fresco.initialize(context);
        picasso = Picasso.with(ctx);
        glide = Glide.with(ctx);
        universalImageLoader = ImageLoader.getInstance();
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .diskCache(new UnlimitedDiskCache(ctx.getCacheDir())) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
//                .writeDebugLogs()
                .build();
        universalImageLoader.init(config);
        ion = Ion.getDefault(context);
    }
 
開發者ID:ShionTatarian,項目名稱:ImageCompare,代碼行數:22,代碼來源:ImageUtil.java

示例8: initImageLoader

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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: UILKit

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
/**
 * 初始化
 *
 * @param context
 */
private UILKit(Context context) {
    File cacheDir = getDiskCacheDir(context, "img");

    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCacheSize(10 * 1024 * 1024)
            .diskCache(new UnlimitedDiskCache(cacheDir))
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .diskCacheSize(50 * 1024 * 1024) // 50 MiB
            .tasksProcessingOrder(QueueProcessingType.LIFO);

    ImageLoader.getInstance().init(config.build());



    picOptions = new DisplayImageOptions.Builder()
            .imageScaleType(ImageScaleType.EXACTLY)
            .cacheOnDisk(false).cacheInMemory(false)
            .resetViewBeforeLoading(true)
            .displayer(new FadeInBitmapDisplayer(500)).build();
}
 
開發者ID:limedroid,項目名稱:XRichText,代碼行數:28,代碼來源:UILKit.java

示例10: initUil

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
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);
}
 
開發者ID:BigAppOS,項目名稱:BigApp_WordPress_Android,代碼行數:17,代碼來源:BaseApplication.java

示例11: initImageLoader

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
/** 初始化imageLoader */
private void initImageLoader() {
	DisplayImageOptions options = new DisplayImageOptions.Builder().showImageForEmptyUri(com.yiw.circledemo.R.color.bg_no_photo)
			.showImageOnFail(com.yiw.circledemo.R.color.bg_no_photo).showImageOnLoading(com.yiw.circledemo.R.color.bg_no_photo).cacheInMemory(true)
			.cacheOnDisk(true).build();

	File cacheDir = new File(DEFAULT_SAVE_IMAGE_PATH);
	ImageLoaderConfiguration imageconfig = new ImageLoaderConfiguration.Builder(this)
			.threadPriority(Thread.NORM_PRIORITY - 2)
			.denyCacheImageMultipleSizesInMemory()
			.diskCacheSize(50 * 1024 * 1024)
			.diskCacheFileCount(200)
			.diskCache(new UnlimitedDiskCache(cacheDir))
			.diskCacheFileNameGenerator(new Md5FileNameGenerator())
			.defaultDisplayImageOptions(options).build();

	ImageLoader.getInstance().init(imageconfig);
}
 
開發者ID:GinRyan,項目名稱:FriendCircleDemo,代碼行數:19,代碼來源:MyApplication.java

示例12: initImageLoader

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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

示例13: onCreate

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
@Override
	public void onCreate()
	{
		super.onCreate();
//		initTypeface();
		ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder
				(getApplicationContext())
				.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
				.memoryCacheSize(2 * 1024 * 1024)
				.diskCacheSize(50 * 1024 * 1024)
				.diskCacheFileCount(100)
				.diskCache(new UnlimitedDiskCache(FileUtils.getImageCacheDir()))
//				.writeDebugLogs()
				.build();
		//Initialize ImageLoader with configuration.
		JMessageClient.init(getApplicationContext());
		JPushInterface.setDebugMode(true);
		JMessageClient.setNotificationMode(JMessageClient.NOTI_MODE_DEFAULT);
		ImageLoader.getInstance().init(configuration);
	}
 
開發者ID:ChenAt,項目名稱:Translation,代碼行數:21,代碼來源:MyApplication.java

示例14: createDiskCache

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的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:jiangqqlmj,項目名稱:Android-Universal-Image-Loader-Modify,代碼行數:24,代碼來源:DefaultConfigurationFactory.java

示例15: initConfig

import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache; //導入依賴的package包/類
private void initConfig() {
    DisplayImageOptions localDisplayImageOptions = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory());
    //用最大內存的1/8來存儲圖片
    final int cacheSize = maxMemory / 8;
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .memoryCacheExtraOptions(W, H) // default = device screen dimensions
            .threadPoolSize(2) // default
            .threadPriority(Thread.NORM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(cacheSize))
            .memoryCacheSize(cacheSize)
            .memoryCacheSizePercentage(13) // default
            .diskCache(new UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(getApplicationContext(), config.PATH.CHACHE_PATH))) // default
            .diskCacheSize(10 * 1024 * 1024)
            .diskCacheFileCount(100)//.writeDebugLogs()
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default
            .defaultDisplayImageOptions(localDisplayImageOptions)
            .build();
    ImageLoader.getInstance().init(configuration);
}
 
開發者ID:qbeenslee,項目名稱:Nepenthes-Android,代碼行數:24,代碼來源:NeApp.java


注:本文中的com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。