Skip to content

Instantly share code, notes, and snippets.

@DevPicon
Created January 31, 2018 21:14
Show Gist options
  • Save DevPicon/e30a892d2240731fab6fce73974abe17 to your computer and use it in GitHub Desktop.
Save DevPicon/e30a892d2240731fab6fce73974abe17 to your computer and use it in GitHub Desktop.
/**
* 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