Prefetch images in Group mall and reactions icons
Reviewed By: ericvicenti Differential Revision: D3227821 fb-gh-sync-id: b7a8c3e6e82604b98ec0d25eaab0c3b4c95bd683 fbshipit-source-id: b7a8c3e6e82604b98ec0d25eaab0c3b4c95bd683
This commit is contained in:
parent
8cfa6b6ea6
commit
4e05d00f0d
|
@ -28,8 +28,16 @@ public class ImageLoaderModule extends ReactContextBaseJavaModule {
|
||||||
private static final String ERROR_INVALID_URI = "E_INVALID_URI";
|
private static final String ERROR_INVALID_URI = "E_INVALID_URI";
|
||||||
private static final String ERROR_PREFETCH_FAILURE = "E_PREFETCH_FAILURE";
|
private static final String ERROR_PREFETCH_FAILURE = "E_PREFETCH_FAILURE";
|
||||||
|
|
||||||
|
private final Object mCallerContext;
|
||||||
|
|
||||||
public ImageLoaderModule(ReactApplicationContext reactContext) {
|
public ImageLoaderModule(ReactApplicationContext reactContext) {
|
||||||
super(reactContext);
|
super(reactContext);
|
||||||
|
mCallerContext = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageLoaderModule(ReactApplicationContext reactContext, Object callerContext) {
|
||||||
|
super(reactContext);
|
||||||
|
mCallerContext = callerContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,7 +62,8 @@ public class ImageLoaderModule extends ReactContextBaseJavaModule {
|
||||||
Uri uri = Uri.parse(uriString);
|
Uri uri = Uri.parse(uriString);
|
||||||
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).build();
|
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).build();
|
||||||
|
|
||||||
DataSource<Void> prefetchSource = Fresco.getImagePipeline().prefetchToDiskCache(request, this);
|
DataSource<Void> prefetchSource =
|
||||||
|
Fresco.getImagePipeline().prefetchToDiskCache(request, mCallerContext);
|
||||||
DataSubscriber<Void> prefetchSubscriber = new BaseDataSubscriber<Void>() {
|
DataSubscriber<Void> prefetchSubscriber = new BaseDataSubscriber<Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected void onNewResultImpl(DataSource<Void> dataSource) {
|
protected void onNewResultImpl(DataSource<Void> dataSource) {
|
||||||
|
|
Loading…
Reference in New Issue