/** * 获取磁盘上副缓存(小文件)文件缓存的大小 */ public static long getSmallImageFileCache() { Fresco.getImagePipelineFactory().getSmallImageFileCache().trimToMinimum(); return Fresco.getImagePipelineFactory().getSmallImageFileCache().getSize(); }
public static File getCachedImageOnDisk(CacheKey cacheKey) { File localFile = null; if (cacheKey != null) { if (ImagePipelineFactory.getInstance().getMainFileCache().hasKey(cacheKey)) { BinaryResource resource = ImagePipelineFactory.getInstance().getMainDiskStorageCache().getResource(cacheKey); localFile = ((FileBinaryResource) resource).getFile(); } else if (ImagePipelineFactory.getInstance().getSmallImageFileCache().hasKey(cacheKey)) { BinaryResource resource = ImagePipelineFactory.getInstance().getSmallImageFileCache().getResource(cacheKey); localFile = ((FileBinaryResource) resource).getFile(); } } return localFile; }
public static boolean isImageDownloaded(Context context, Uri loadUri) { if (loadUri == null) { return false; } CacheKey cacheKey = DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(ImageRequest.fromUri(loadUri), context); return ImagePipelineFactory.getInstance().getMainFileCache().hasKey(cacheKey) || ImagePipelineFactory.getInstance().getSmallImageFileCache().hasKey(cacheKey); }
private File getCachedImageOnDisk(String url) { CacheKey key = getCacheKey(url); if (key == null) { return null; } File localFile = null; if (ImagePipelineFactory.getInstance().getMainFileCache().hasKey(key)) { BinaryResource resource = ImagePipelineFactory.getInstance().getMainFileCache().getResource(key); if (resource != null) { localFile = ((FileBinaryResource) resource).getFile(); } } else if (ImagePipelineFactory.getInstance().getSmallImageFileCache().hasKey(key)) { BinaryResource resource = ImagePipelineFactory.getInstance().getSmallImageFileCache().getResource(key); if (resource != null) { localFile = ((FileBinaryResource) resource).getFile(); } } return localFile; }
public static File getCachedImageOnDisk(Context context, Uri loadUri) { File localFile = null; if (loadUri != null) { CacheKey cacheKey = DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(ImageRequest.fromUri(loadUri), context); if (ImagePipelineFactory.getInstance().getMainFileCache().hasKey(cacheKey)) { BinaryResource resource = ImagePipelineFactory.getInstance().getMainFileCache().getResource(cacheKey); localFile = ((FileBinaryResource) resource).getFile(); } else if (ImagePipelineFactory.getInstance().getSmallImageFileCache().hasKey(cacheKey)) { BinaryResource resource = ImagePipelineFactory.getInstance().getSmallImageFileCache().getResource(cacheKey); localFile = ((FileBinaryResource) resource).getFile(); } } return localFile; } }