From d8f421098c60cab28ee75b7d7f2f14cbd894b267 Mon Sep 17 00:00:00 2001 From: Sihua Ma Date: Fri, 17 Jan 2025 07:20:59 +0000 Subject: [PATCH] Invalidate after changing ring path translation Additionally set ring path translation only when there is a change in the icon size. Also adding logs to print measured width and normalized icon size. Test: Manual Bug: 387844520 Flag: EXEMPT bug fix Change-Id: I9fee51f4dc096d8c03076bd0787ec25b5e358edc --- .../launcher3/uioverrides/PredictedAppIcon.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java index caac35efe1..b0cb48448e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java +++ b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java @@ -36,6 +36,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.FloatProperty; +import android.util.Log; import android.util.Property; import android.view.LayoutInflater; import android.view.ViewGroup; @@ -110,6 +111,8 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView { private boolean mForceHideRing = false; private Animator mRingScaleAnim; + private int mWidth; + private static final FloatProperty SLOT_MACHINE_TRANSLATION_Y = new FloatProperty("slotMachineTranslationY") { @Override @@ -300,7 +303,13 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView { } private int getOutlineOffsetX() { - return (getMeasuredWidth() - mNormalizedIconSize) / 2; + int measuredWidth = getMeasuredWidth(); + if (mDisplay != DISPLAY_TASKBAR) { + Log.d("b/387844520", "getOutlineOffsetX: measured width = " + measuredWidth + + ", mNormalizedIconSize = " + mNormalizedIconSize + + ", last updated width = " + mWidth); + } + return (mWidth - mNormalizedIconSize) / 2; } private int getOutlineOffsetY() { @@ -313,7 +322,11 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); + mWidth = w; mSlotIconBound.offsetTo((w - getIconSize()) / 2, (h - getIconSize()) / 2); + if (mDisplay != DISPLAY_TASKBAR) { + Log.d("b/387844520", "calling updateRingPath from onSizeChanged"); + } updateRingPath(); } @@ -325,6 +338,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView { private void updateRingPath() { mRingPath.reset(); + mTmpMatrix.reset(); mTmpMatrix.setTranslate(getOutlineOffsetX(), getOutlineOffsetY()); mRingPath.addPath(mShapePath, mTmpMatrix); @@ -339,6 +353,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView { mTmpMatrix.preTranslate(-mNormalizedIconSize, -mNormalizedIconSize); mRingPath.addPath(mShapePath, mTmpMatrix); } + invalidate(); } @Override