Merge "Invalidate after changing ring path translation" into main

This commit is contained in:
Sihua Ma authored and Android (Google) Code Review committed 2025-01-17 19:55:27 -08:00
commit 009c0971c4
1 file changed
+16 -1
@@ -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<PredictedAppIcon> SLOT_MACHINE_TRANSLATION_Y =
new FloatProperty<PredictedAppIcon>("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