mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Show low res image if available in cache
Summary: Nodes version of D3392751. Reviewed By: ahmedre Differential Revision: D3425740
This commit is contained in:
committed by
Ahmed El-Helw
parent
c61aafe95d
commit
fc622504de
@@ -44,7 +44,6 @@ import com.facebook.react.views.image.ReactImageView;
|
||||
private static final int BORDER_BITMAP_PATH_DIRTY = 1 << 1;
|
||||
|
||||
private @Nullable Map<String, Double> mSources;
|
||||
private @Nullable String mImageSource;
|
||||
private @Nullable Context mContext;
|
||||
private final Matrix mTransform = new Matrix();
|
||||
private ScaleType mScaleType = ImageResizeMode.defaultValue();
|
||||
@@ -226,18 +225,18 @@ import com.facebook.react.views.image.ReactImageView;
|
||||
}
|
||||
|
||||
private void computeRequestHelper() {
|
||||
mImageSource = getSourceImage();
|
||||
if (mImageSource == null) {
|
||||
String[] imageSources = getImageSources();
|
||||
if (imageSources == null) {
|
||||
mRequestHelper = null;
|
||||
return;
|
||||
}
|
||||
ImageRequest imageRequest =
|
||||
ImageRequestHelper.createImageRequest(Assertions.assertNotNull(mContext),
|
||||
mImageSource);
|
||||
ImageRequestHelper.createImageRequest(Assertions.assertNotNull(mContext), imageSources[0]);
|
||||
// DrawImageWithPipeline does now support displaying low res cache images before request
|
||||
mRequestHelper = new PipelineRequestHelper(Assertions.assertNotNull(imageRequest));
|
||||
}
|
||||
|
||||
private String getSourceImage() {
|
||||
private @Nullable String[] getImageSources() {
|
||||
if (mSources == null || mSources.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -245,7 +244,7 @@ import com.facebook.react.views.image.ReactImageView;
|
||||
final double targetImageSize = (getRight() - getLeft()) * (getBottom() - getTop());
|
||||
return MultiSourceImageHelper.getImageSourceFromMultipleSources(targetImageSize, mSources);
|
||||
}
|
||||
return mSources.keySet().iterator().next();
|
||||
return new String[]{mSources.keySet().iterator().next()};
|
||||
}
|
||||
|
||||
private boolean hasMultipleSources() {
|
||||
|
||||
Reference in New Issue
Block a user