summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mykola Podolian <mpodolian@google.com> 2024-05-01 08:40:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-05-01 08:40:26 +0000
commit0eb2ee27d8a44ef07e416236ab2033563f53e14c (patch)
tree6a2c466692a84662b26c0823a81931641dc20eae
parentd758a6bb43cb17bc253ad0c7832047668f15ad10 (diff)
parent364c73a992cb54b0e5b7ff1551a3681bd793b822 (diff)
Merge "Fixed bubble badge position on stack move." into main
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java
index 0297901c8921..f9a1d940c734 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java
@@ -82,8 +82,8 @@ public class BadgedImageView extends ConstraintLayout {
private BubbleViewProvider mBubble;
private BubblePositioner mPositioner;
- private boolean mOnLeft;
-
+ private boolean mBadgeOnLeft;
+ private boolean mDotOnLeft;
private DotRenderer mDotRenderer;
private DotRenderer.DrawParams mDrawParams;
private int mDotColor;
@@ -153,7 +153,8 @@ public class BadgedImageView extends ConstraintLayout {
public void hideDotAndBadge(boolean onLeft) {
addDotSuppressionFlag(BadgedImageView.SuppressionFlag.BEHIND_STACK);
- mOnLeft = onLeft;
+ mBadgeOnLeft = onLeft;
+ mDotOnLeft = onLeft;
hideBadge();
}
@@ -185,7 +186,7 @@ public class BadgedImageView extends ConstraintLayout {
mDrawParams.dotColor = mDotColor;
mDrawParams.iconBounds = mTempBounds;
- mDrawParams.leftAlign = mOnLeft;
+ mDrawParams.leftAlign = mDotOnLeft;
mDrawParams.scale = mDotScale;
mDotRenderer.draw(canvas, mDrawParams);
@@ -255,7 +256,7 @@ public class BadgedImageView extends ConstraintLayout {
* Whether decorations (badges or dots) are on the left.
*/
boolean getDotOnLeft() {
- return mOnLeft;
+ return mDotOnLeft;
}
/**
@@ -263,7 +264,7 @@ public class BadgedImageView extends ConstraintLayout {
*/
float[] getDotCenter() {
float[] dotPosition;
- if (mOnLeft) {
+ if (mDotOnLeft) {
dotPosition = mDotRenderer.getLeftDotPosition();
} else {
dotPosition = mDotRenderer.getRightDotPosition();
@@ -291,22 +292,23 @@ public class BadgedImageView extends ConstraintLayout {
if (onLeft != getDotOnLeft()) {
if (shouldDrawDot()) {
animateDotScale(0f /* showDot */, () -> {
- mOnLeft = onLeft;
+ mDotOnLeft = onLeft;
invalidate();
animateDotScale(1.0f, null /* after */);
});
} else {
- mOnLeft = onLeft;
+ mDotOnLeft = onLeft;
}
}
+ mBadgeOnLeft = onLeft;
// TODO animate badge
showBadge();
-
}
/** Sets the position of the dot and badge. */
void setDotBadgeOnLeft(boolean onLeft) {
- mOnLeft = onLeft;
+ mBadgeOnLeft = onLeft;
+ mDotOnLeft = onLeft;
invalidate();
showBadge();
}
@@ -361,7 +363,7 @@ public class BadgedImageView extends ConstraintLayout {
}
int translationX;
- if (mOnLeft) {
+ if (mBadgeOnLeft) {
translationX = -(mBubble.getBubbleIcon().getWidth() - appBadgeBitmap.getWidth());
} else {
translationX = 0;