From 064114f9434a45ba7bca3966954bb62a0b8e1e2f Mon Sep 17 00:00:00 2001 From: Yuriy Budiyev Date: Thu, 1 Mar 2018 16:47:35 +0300 Subject: [PATCH] Dev --- .../imageloader/BaseLoadImageAction.java | 18 ------------------ .../imageloader/DisplayImageAction.java | 5 ++++- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/budiyev/android/imageloader/BaseLoadImageAction.java b/src/main/java/com/budiyev/android/imageloader/BaseLoadImageAction.java index 9d83bfe..a4592a3 100644 --- a/src/main/java/com/budiyev/android/imageloader/BaseLoadImageAction.java +++ b/src/main/java/com/budiyev/android/imageloader/BaseLoadImageAction.java @@ -179,9 +179,6 @@ protected final void loadImage() { return; } } - if (isCancelled()) { - return; - } // Storage cache ImageCache storageCache = mStorageCache; if (key != null && storageCache != null) { @@ -194,9 +191,6 @@ protected final void loadImage() { return; } } - if (isCancelled()) { - return; - } // Load new image Size requiredSize = mRequiredSize; try { @@ -209,9 +203,6 @@ protected final void loadImage() { processError(new ImageNotLoadedException()); return; } - if (isCancelled()) { - return; - } // Transform image BitmapTransformation transformation = mTransformation; if (transformation != null) { @@ -227,9 +218,6 @@ protected final void loadImage() { } } processImage(image); - if (isCancelled()) { - return; - } if (key != null) { if (memoryCache != null) { memoryCache.put(key, image); @@ -248,9 +236,6 @@ protected final void loadImage() { @WorkerThread private void processImage(@NonNull Bitmap image) { - if (isCancelled()) { - return; - } LoadCallback loadCallback = mLoadCallback; if (loadCallback != null) { loadCallback.onLoaded(image); @@ -260,9 +245,6 @@ private void processImage(@NonNull Bitmap image) { @WorkerThread private void processError(@NonNull Throwable error) { - if (isCancelled()) { - return; - } ErrorCallback errorCallback = mErrorCallback; if (errorCallback != null) { errorCallback.onError(error); diff --git a/src/main/java/com/budiyev/android/imageloader/DisplayImageAction.java b/src/main/java/com/budiyev/android/imageloader/DisplayImageAction.java index 8547975..d215193 100644 --- a/src/main/java/com/budiyev/android/imageloader/DisplayImageAction.java +++ b/src/main/java/com/budiyev/android/imageloader/DisplayImageAction.java @@ -98,9 +98,12 @@ protected void onCancelled() { private final class SetErrorDrawableAction implements Runnable { @Override public void run() { + if (isCancelled()) { + return; + } Drawable errorDrawable = mErrorDrawable; View view = mView.get(); - if (isCancelled() || errorDrawable == null || view == null || + if (errorDrawable == null || view == null || InternalUtils.getDisplayImageAction(view) != DisplayImageAction.this) { return; }