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
diff --git a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
index caac35e..b0cb484 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.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 @@
private boolean mForceHideRing = false;
private Animator mRingScaleAnim;
+ private int mWidth;
+
private static final FloatProperty<PredictedAppIcon> SLOT_MACHINE_TRANSLATION_Y =
new FloatProperty<PredictedAppIcon>("slotMachineTranslationY") {
@Override
@@ -300,7 +303,13 @@
}
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 @@
@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 @@
private void updateRingPath() {
mRingPath.reset();
+ mTmpMatrix.reset();
mTmpMatrix.setTranslate(getOutlineOffsetX(), getOutlineOffsetY());
mRingPath.addPath(mShapePath, mTmpMatrix);
@@ -339,6 +353,7 @@
mTmpMatrix.preTranslate(-mNormalizedIconSize, -mNormalizedIconSize);
mRingPath.addPath(mShapePath, mTmpMatrix);
}
+ invalidate();
}
@Override