So basically I'd like to access the file/ByteArray of the Image or Gif that was loaded into a SimpleDraweeView. When Fresco downloads an image from a url, I want to save that image in my database for future access (to help reduce data usage) since these images do not change. This way, next time I want to load an image into the SimpleDraweeView I load the local media and no need to download it again from the url.
I tried a couple of approaches after adding a listener to the Fresco.newDraweeControllerBuilder where on the onFinalImageSet I was either:
1- Trying to access the File for the image/gif from the cache used by Fresco to get it's ByteArray, however, I always get a hasKey() = False from the ImagePipelineFactory:
val imageRequest = ImageRequest.fromUri(mediaUrl)
val cacheKey = DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(imageRequest, null)
if(ImagePipelineFactory.getInstance().mainFileCache.hasKey(cacheKey)) {
    val resource = ImagePipelineFactory.getInstance().mainFileCache.getResource(cacheKey) 
    val file = (resource as FileBinaryResource).file
}else if (ImagePipelineFactory.getInstance().smallImageFileCache.hasKey(cacheKey)){
    val resource = ImagePipelineFactory.getInstance().mainFileCache.getResource(cacheKey) 
    val file = (resource as FileBinaryResource).file
}
2- Trying to get the bitmap from the imageInfo (as a CloseableStaticBitmap) or animatable (as a CloseableAnimateImage) however if I want to cast the animatable to that CloseableAnimateImage I get a compilation error "unresolved reference: CloseableAnimateImage". Then the idea was to get the ByteArray from the bitmap and save it. Nevertheless, I really want to get the (1) approach.
Any ideas of how to get the cached file? Thank you in advance!
 
     
    