com.nostra13.universalimageloader.cache.disc.DiskCache Java Examples

The following examples show how to use com.nostra13.universalimageloader.cache.disc.DiskCache. 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 android-open-project-demo with Apache License 2.0 6 votes vote down vote up
/**
 * 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: DefaultConfigurationFactory.java    From candybar with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: DefaultConfigurationFactory.java    From WliveTV with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: DefaultConfigurationFactory.java    From BigApp_WordPress_Android with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: DefaultConfigurationFactory.java    From mobile-manager-tool with MIT License 6 votes vote down vote up
/**
 * 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 #6
Source File: DefaultConfigurationFactory.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 6 votes vote down vote up
/**
 * 默认图片 本地路径缓存
 * 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);
}
 
Example #7
Source File: DefaultConfigurationFactory.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example #8
Source File: ImageLoaderConfiguration$Builder.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public diskCacheSize diskCache(DiskCache diskcache)
{
    if (t > 0L || u > 0)
    {
        L.w("diskCache(), diskCacheSize() and diskCacheFileCount calls overlap each other", new Object[0]);
    }
    if (x != null)
    {
        L.w("diskCache() and diskCacheFileNameGenerator() calls overlap each other", new Object[0]);
    }
    w = diskcache;
    return this;
}
 
Example #9
Source File: ImageLoaderConfiguration.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public Builder diskCache(DiskCache diskcache)
{
    if (t > 0L || u > 0)
    {
        L.w("diskCache(), diskCacheSize() and diskCacheFileCount calls overlap each other", new Object[0]);
    }
    if (x != null)
    {
        L.w("diskCache() and diskCacheFileNameGenerator() calls overlap each other", new Object[0]);
    }
    w = diskcache;
    return this;
}
 
Example #10
Source File: DiskCacheUtils.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public static File findInCache(String s, DiskCache diskcache)
{
    File file = diskcache.get(s);
    if (file != null && file.exists())
    {
        return file;
    } else
    {
        return null;
    }
}
 
Example #11
Source File: DefaultConfigurationFactory.java    From letv with Apache License 2.0 5 votes vote down vote up
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 #12
Source File: ImageLoader.java    From letv with Apache License 2.0 4 votes vote down vote up
@Deprecated
public DiskCache getDiscCache() {
    return getDiskCache();
}
 
Example #13
Source File: ImageLoaderConfiguration.java    From candybar with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated Use {@link #diskCache(com.nostra13.universalimageloader.cache.disc.DiskCache)}
 */
@Deprecated
public Builder discCache(DiskCache diskCache) {
    return diskCache(diskCache);
}
 
Example #14
Source File: ImageLoaderConfiguration$Builder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public q discCache(DiskCache diskcache)
{
    return diskCache(diskcache);
}
 
Example #15
Source File: ImageLoaderConfiguration$Builder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
static DiskCache l(r r1)
{
    return r1.w;
}
 
Example #16
Source File: ImageLoader.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public DiskCache getDiskCache()
{
    a();
    return h.o;
}
 
Example #17
Source File: ImageLoader.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public DiskCache getDiscCache()
{
    return getDiskCache();
}
 
Example #18
Source File: ImageLoaderConfiguration.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public Builder discCache(DiskCache diskcache)
{
    return diskCache(diskcache);
}
 
Example #19
Source File: ImageLoaderConfiguration.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
static DiskCache l(Builder builder)
{
    return builder.w;
}
 
Example #20
Source File: DiskCacheUtils.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static boolean removeFromCache(String s, DiskCache diskcache)
{
    File file = diskcache.get(s);
    return file != null && file.exists() && file.delete();
}
 
Example #21
Source File: ImageLoaderConfiguration.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link #diskCache(com.nostra13.universalimageloader.cache.disc.DiskCache)} */
@Deprecated
public Builder discCache(DiskCache diskCache) {
	return diskCache(diskCache);
}
 
Example #22
Source File: DiskCacheUtils.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 4 votes vote down vote up
/**
 * Returns {@link File} of cached image or <b>null</b> if image was not cached in disk cache
 * 从文件缓存中根据图片链接地址获取缓存的文件
 */
public static File findInCache(String imageUri, DiskCache diskCache) {
	File image = diskCache.get(imageUri);
	return image != null && image.exists() ? image : null;
}
 
Example #23
Source File: ImageLoaderConfiguration.java    From WliveTV with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link #diskCache(com.nostra13.universalimageloader.cache.disc.DiskCache)} */
@Deprecated
public Builder discCache(DiskCache diskCache) {
	return diskCache(diskCache);
}
 
Example #24
Source File: DiskCacheUtils.java    From candybar with Apache License 2.0 4 votes vote down vote up
/**
 * Returns {@link File} of cached image or <b>null</b> if image was not cached in disk cache
 */
public static File findInCache(String imageUri, DiskCache diskCache) {
    File image = diskCache.get(imageUri);
    return image != null && image.exists() ? image : null;
}
 
Example #25
Source File: DiskCacheUtils.java    From WliveTV with Apache License 2.0 4 votes vote down vote up
/** Returns {@link File} of cached image or <b>null</b> if image was not cached in disk cache */
public static File findInCache(String imageUri, DiskCache diskCache) {
	File image = diskCache.get(imageUri);
	return image != null && image.exists() ? image : null;
}
 
Example #26
Source File: ImageLoaderConfiguration.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link #diskCache(com.nostra13.universalimageloader.cache.disc.DiskCache)} */
@Deprecated
public Builder discCache(DiskCache diskCache) {
	return diskCache(diskCache);
}
 
Example #27
Source File: ImageLoader.java    From letv with Apache License 2.0 4 votes vote down vote up
public DiskCache getDiskCache() {
    checkConfiguration();
    return this.configuration.diskCache;
}
 
Example #28
Source File: LetvCacheConfiguration.java    From letv with Apache License 2.0 4 votes vote down vote up
public static DiskCache getDiscCache() {
    return new UnlimitedDiscCache(new File(ConstantTool.IMAGE_CACHE_PATH), null, new Md5FileNameGenerator());
}
 
Example #29
Source File: DiskCacheUtils.java    From mobile-manager-tool with MIT License 4 votes vote down vote up
/** Returns {@link java.io.File} of cached image or <b>null</b> if image was not cached in disk cache */
public static File findInCache(String imageUri, DiskCache diskCache) {
	File image = diskCache.get(imageUri);
	return image != null && image.exists() ? image : null;
}
 
Example #30
Source File: ImageLoaderConfiguration.java    From mobile-manager-tool with MIT License 4 votes vote down vote up
/** @deprecated Use {@link #diskCache(com.nostra13.universalimageloader.cache.disc.DiskCache)} */
@Deprecated
public Builder discCache(DiskCache diskCache) {
	return diskCache(diskCache);
}