Add docs for Fresco image attribution
Reviewed By: passy Differential Revision: D15900104 fbshipit-source-id: 90f53fefbedfa32ed275900542f94650f487a679
This commit is contained in:
committed by
Facebook Github Bot
parent
3307576cb7
commit
c22bdbe205
@@ -61,4 +61,28 @@ client.addPlugin(new FrescoFlipperPlugin(
|
||||
new NoOpFlipperPerfLogger(),
|
||||
null,
|
||||
leakTracker));
|
||||
```
|
||||
```
|
||||
|
||||
### Attribution
|
||||
|
||||
In order to annotate images with the context they are used in, you have to set a
|
||||
caller context when loading the image. This can be any object, so for the simplest
|
||||
case, a String will suffice.
|
||||
|
||||
```java
|
||||
String callerContext = "my_feature";
|
||||
|
||||
// For DraweeViews:
|
||||
draweeView.setImageURI(uri, callerContext);
|
||||
|
||||
// For prefetching:
|
||||
ImagePipeline imagePipeline = Fresco.getImagePipeline();
|
||||
imagePipeline.prefetchToDiskCache(imageRequest, callerContext);
|
||||
|
||||
// For manually fetching an image:
|
||||
DataSource<CloseableReference<CloseableImage>>
|
||||
dataSource = imagePipeline.fetchDecodedImage(imageRequest, callerContext);
|
||||
```
|
||||
|
||||
If a caller context is supplied, the image will be properly attributed in the
|
||||
Flipper image plugin.
|
||||
|
||||
Reference in New Issue
Block a user