Search in sources :

Example 1 with FileCache

use of com.facebook.cache.disk.FileCache in project BigImageViewer by Piasy.

the class FrescoImageLoader method getCacheFile.

private File getCacheFile(final ImageRequest request) {
    FileCache mainFileCache = ImagePipelineFactory.getInstance().getMainFileCache();
    final CacheKey cacheKey = DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(request, // we don't need context, but avoid null
    false);
    File cacheFile = request.getSourceFile();
    // http://crashes.to/s/ee10638fb31
    if (mainFileCache.hasKey(cacheKey) && mainFileCache.getResource(cacheKey) != null) {
        cacheFile = ((FileBinaryResource) mainFileCache.getResource(cacheKey)).getFile();
    }
    return cacheFile;
}
Also used : File(java.io.File) CacheKey(com.facebook.cache.common.CacheKey) FileCache(com.facebook.cache.disk.FileCache)

Aggregations

CacheKey (com.facebook.cache.common.CacheKey)1 FileCache (com.facebook.cache.disk.FileCache)1 File (java.io.File)1