Fix AllAppsSearchPlugin icon redrawing without special-casing.
Preventing icon animations in deep shortcuts fixed the icon redrawing issue in the all apps search page, however other icons could still be redrawn, yet could not be special-cased without removing icon update animations altogether. Added logic to only animate icon updates outside of the all apps search page.
Demo: https://drive.google.com/file/d/1ReT2O_1tV20terY0Jr1NJGxIxPblHCK4/view?usp=sharing
Change-Id: Ibe0b43801ec5340c3551125aef13170d569d2c55
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 5cd6372..3eb52ad 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -171,6 +171,8 @@
private IconLoadRequest mIconLoadRequest;
+ private boolean mEnableIconUpdateAnimation = false;
+
public BubbleTextView(Context context) {
this(context, null, 0);
}
@@ -697,6 +699,10 @@
applyCompoundDrawables(icon);
}
+ protected boolean iconUpdateAnimationEnabled() {
+ return mEnableIconUpdateAnimation;
+ }
+
protected void applyCompoundDrawables(Drawable icon) {
// If we had already set an icon before, disable relayout as the icon size is the
// same as before.
@@ -706,13 +712,10 @@
updateIcon(icon);
- ItemInfo itemInfo = (ItemInfo) getTag();
-
// If the current icon is a placeholder color, animate its update.
if (mIcon != null
&& mIcon instanceof PlaceHolderIconDrawable
- && (itemInfo == null
- || itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT)) {
+ && iconUpdateAnimationEnabled()) {
animateIconUpdate((PlaceHolderIconDrawable) mIcon, icon);
}
@@ -734,6 +737,7 @@
if (getTag() == info) {
mIconLoadRequest = null;
mDisableRelayout = true;
+ mEnableIconUpdateAnimation = true;
// Optimization: Starting in N, pre-uploads the bitmap to RenderThread.
info.bitmap.icon.prepareToDraw();
@@ -750,6 +754,7 @@
}
mDisableRelayout = false;
+ mEnableIconUpdateAnimation = false;
}
}