diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-09-10 16:49:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-09-10 16:49:24 +0000 |
commit | 8aee0b2cb54df59df230df113c1c295b2ceb9d72 (patch) | |
tree | 7a3bd13c9c60caf4499ceebf7bfcd7bb92dffff4 /src | |
parent | 735d1fe124812fd11feabc644c9a4f8482039f57 (diff) | |
parent | bdda7251dfdf6901f495c57ba26944e88222d78f (diff) | |
download | android_packages_apps_Trebuchet-8aee0b2cb54df59df230df113c1c295b2ceb9d72.tar.gz android_packages_apps_Trebuchet-8aee0b2cb54df59df230df113c1c295b2ceb9d72.tar.bz2 android_packages_apps_Trebuchet-8aee0b2cb54df59df230df113c1c295b2ceb9d72.zip |
Merge "Ensure the icon load request matches the ItemInfo for the floating view." into ub-launcher3-qt-qpr1-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/views/FloatingIconView.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 15b8d4675..f728a6776 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -721,7 +721,7 @@ public class FloatingIconView extends View implements */ @UiThread public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) { - IconLoadResult result = new IconLoadResult(); + IconLoadResult result = new IconLoadResult(info); new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> { RectF position = new RectF(); getLocationBoundsForView(l, v, isOpening, position); @@ -750,10 +750,13 @@ public class FloatingIconView extends View implements // Get the drawable on the background thread boolean shouldLoadIcon = originalView.getTag() instanceof ItemInfo && hideOriginal; - view.mIconLoadResult = sIconLoadResult; - if (shouldLoadIcon && view.mIconLoadResult == null) { - view.mIconLoadResult = fetchIcon(launcher, originalView, - (ItemInfo) originalView.getTag(), isOpening); + if (shouldLoadIcon) { + if (sIconLoadResult != null && sIconLoadResult.itemInfo == originalView.getTag()) { + view.mIconLoadResult = sIconLoadResult; + } else { + view.mIconLoadResult = fetchIcon(launcher, originalView, + (ItemInfo) originalView.getTag(), isOpening); + } } sIconLoadResult = null; @@ -895,10 +898,15 @@ public class FloatingIconView extends View implements } private static class IconLoadResult { + final ItemInfo itemInfo; Drawable drawable; Drawable badge; int iconOffset; Runnable onIconLoaded; boolean isIconLoaded; + + public IconLoadResult(ItemInfo itemInfo) { + this.itemInfo = itemInfo; + } } } |