diff options
author | Jon Miranda <jonmiranda@google.com> | 2019-05-01 20:33:54 -0700 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2019-05-02 08:45:27 -0700 |
commit | 27530c99e2b49cec311af356367fb613e4eaa19b (patch) | |
tree | 5ec1bc4ea4321a61962b3c682966cd8791dea897 /src | |
parent | 35bda496f3086cd12820207802b14df3fbf4774c (diff) | |
download | android_packages_apps_Trebuchet-27530c99e2b49cec311af356367fb613e4eaa19b.tar.gz android_packages_apps_Trebuchet-27530c99e2b49cec311af356367fb613e4eaa19b.tar.bz2 android_packages_apps_Trebuchet-27530c99e2b49cec311af356367fb613e4eaa19b.zip |
Use original BubbleTextView icon for legacy stamped forced adaptive icons.
Bug: 129297366
Change-Id: Ic71c42e603cc361b716ba65067a772d19ef394f7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/views/FloatingIconView.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 77f278a19..faa9f4015 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -72,6 +72,7 @@ public class FloatingIconView extends View implements Animator.AnimatorListener, public static final float SHAPE_PROGRESS_DURATION = 0.15f; private static final int FADE_DURATION_MS = 200; private static final Rect sTmpRect = new Rect(); + private static final Object[] sTmpObjArray = new Object[1]; private Runnable mEndRunnable; private CancellationSignal mLoadIconSignal; @@ -208,10 +209,7 @@ public class FloatingIconView extends View implements Animator.AnimatorListener, Drawable drawable = null; boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; - if (!supportsAdaptiveIcons && v instanceof BubbleTextView) { - // Similar to DragView, we simply use the BubbleTextView icon here. - drawable = ((BubbleTextView) v).getIcon(); - } + Drawable btvIcon = v instanceof BubbleTextView ? ((BubbleTextView) v).getIcon() : null; if (info instanceof SystemShortcut) { if (v instanceof ImageView) { drawable = ((ImageView) v).getDrawable(); @@ -220,10 +218,24 @@ public class FloatingIconView extends View implements Animator.AnimatorListener, } else { drawable = v.getBackground(); } - } - if (drawable == null) { - drawable = Utilities.getFullDrawable(launcher, info, lp.width, lp.height, - false, new Object[1]); + } else { + if (supportsAdaptiveIcons) { + drawable = Utilities.getFullDrawable(launcher, info, lp.width, lp.height, + false, sTmpObjArray); + if (!(drawable instanceof AdaptiveIconDrawable)) { + // The drawable we get back is not an adaptive icon, so we need to use the + // BubbleTextView icon that is already legacy treated. + drawable = btvIcon; + } + } else { + if (v instanceof BubbleTextView) { + // Similar to DragView, we simply use the BubbleTextView icon here. + drawable = btvIcon; + } else { + drawable = Utilities.getFullDrawable(launcher, info, lp.width, lp.height, + false, sTmpObjArray); + } + } } Drawable finalDrawable = drawable == null ? null |