react-native-fast-image 9.3.1 → 9.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -832,6 +832,9 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
832
832
|
private Object mModel;
|
|
833
833
|
// Whether the loading image has loaded or failed.
|
|
834
834
|
private boolean mLoadEnded = false;
|
|
835
|
+
// Whether the loading request is the image that's showing loaded again
|
|
836
|
+
// (reloadForSize's or reblur's), which sends no events.
|
|
837
|
+
private boolean mLoadingQuietly = false;
|
|
835
838
|
// Set by reblur: the next load is the same one again, so it doesn't send
|
|
836
839
|
// onLoadStart (it sends its other events, as the load it replaces would
|
|
837
840
|
// have).
|
|
@@ -942,13 +945,16 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
942
945
|
.error(current.clone())
|
|
943
946
|
.listener(new FastImageRequestListener(null, true, false));
|
|
944
947
|
if (meanwhile == null) builder = builder.thumbnail(current);
|
|
945
|
-
into(shown, builder, meanwhile);
|
|
948
|
+
into(shown, builder, meanwhile, true);
|
|
946
949
|
}
|
|
947
950
|
|
|
948
951
|
// blurRadius changed, and nothing else that needs a reload: the image
|
|
949
952
|
// that's showing, blurred again, with no events, as reloadForSize does: it's
|
|
950
953
|
// decoded again from the cache and blurred on Glide's threads, and the view
|
|
951
|
-
// keeps the current image until then
|
|
954
|
+
// keeps the current image until then. If that fails, it shows the image
|
|
955
|
+
// from Glide's caches; cache: 'web' skips them, so the view shows
|
|
956
|
+
// defaultSource (or nothing) then. Also while it's loading again that way
|
|
957
|
+
// (e.g. the blur changes every frame): that load is replaced. A load that
|
|
952
958
|
// hasn't finished starts again with the new blur, without a second
|
|
953
959
|
// onLoadStart. Nothing loaded (defaultSource, which isn't blurred, or
|
|
954
960
|
// nothing): the next load has the new blur.
|
|
@@ -956,7 +962,7 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
956
962
|
private void reblur() {
|
|
957
963
|
if (requestManager == null || mBaseRequest == null) return;
|
|
958
964
|
RequestBuilder<Drawable> shown = mShownRequest;
|
|
959
|
-
if (shown != null && shown == mLoadingRequest) {
|
|
965
|
+
if (shown != null && (shown == mLoadingRequest || mLoadingQuietly)) {
|
|
960
966
|
RequestBuilder<Drawable> request = mBaseRequest.clone().apply(renderingOptions(mModel));
|
|
961
967
|
RequestBuilder<Drawable> current = fromCache(shown);
|
|
962
968
|
Drawable meanwhile = shownCopy(shown);
|
|
@@ -966,7 +972,7 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
966
972
|
.error(current.clone())
|
|
967
973
|
.listener(new FastImageRequestListener(null, true, false));
|
|
968
974
|
if (meanwhile == null) builder = builder.thumbnail(current);
|
|
969
|
-
into(request, builder, meanwhile);
|
|
975
|
+
into(request, builder, meanwhile, true);
|
|
970
976
|
} else if (mLoadingRequest != null && !mLoadEnded) {
|
|
971
977
|
mRestarting = true;
|
|
972
978
|
mNeedsReload = true;
|
|
@@ -1007,10 +1013,13 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
1007
1013
|
|
|
1008
1014
|
// Starts loading the request (built by builder), showing meanwhile (if
|
|
1009
1015
|
// not null) until it loads, and recording the size Glide loads it at. The size callback is added first, so it has the size by
|
|
1010
|
-
// the time the image loads, even from the memory cache.
|
|
1011
|
-
|
|
1016
|
+
// the time the image loads, even from the memory cache. Quiet: the image
|
|
1017
|
+
// that's showing, loaded again (no events).
|
|
1018
|
+
private void into(RequestBuilder<Drawable> request, RequestBuilder<Drawable> builder, @Nullable Drawable meanwhile,
|
|
1019
|
+
boolean quiet) {
|
|
1012
1020
|
final int load = mLoadCount;
|
|
1013
1021
|
mLoadingRequest = request;
|
|
1022
|
+
mLoadingQuietly = quiet;
|
|
1014
1023
|
mLoadEnded = false;
|
|
1015
1024
|
mLoadingWidth = 0;
|
|
1016
1025
|
mLoadingHeight = 0;
|
|
@@ -1218,7 +1227,7 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
1218
1227
|
if (imageSource != null)
|
|
1219
1228
|
builder.listener(new FastImageRequestListener(imageSource, thumbnail, true));
|
|
1220
1229
|
|
|
1221
|
-
into(request, builder, meanwhile);
|
|
1230
|
+
into(request, builder, meanwhile, false);
|
|
1222
1231
|
}
|
|
1223
1232
|
}
|
|
1224
1233
|
|