Created
November 19, 2015 10:14
-
-
Save HugoGresse/b196f6156d7d6e84d710 to your computer and use it in GitHub Desktop.
Fresco custom initialize with disk cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Configure fresco using ONLY disk cache | |
*/ | |
public void configFresco() { | |
Supplier<File> diskSupplier = new Supplier<File>() { | |
public File get() { | |
return getApplicationContext().getCacheDir(); | |
} | |
}; | |
DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder() | |
.setBaseDirectoryName("images") | |
.setBaseDirectoryPathSupplier(diskSupplier) | |
.build(); | |
ImagePipelineConfig frescoConfig = ImagePipelineConfig.newBuilder(this) | |
.setMainDiskCacheConfig(diskCacheConfig) | |
.build(); | |
Fresco.initialize(this, frescoConfig); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank You, it's useful for me