Don't reset alpha after dragging to dismiss

After dragging the bubble bar to dismiss, don't reset its alpha
value.

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 359804931
Test: manual
      - Create a bubble in the bubble bar
      - Drag bubble bar to dismiss
      - Create another bubble
      - Observe the new bubble does not flicker
Change-Id: I8d56f71d38ec33acda8efade50735b59254d77d4
This commit is contained in:
Liran Binyamin
2024-08-14 08:08:40 -04:00
parent de9b1df642
commit afdad57bdf
2 changed files with 10 additions and 5 deletions
@@ -647,7 +647,9 @@ public class BubbleBarView extends FrameLayout {
}
setAlphaDuringBubbleDrag(1f);
setTranslationX(0f);
setAlpha(1f);
if (getBubbleChildCount() > 0) {
setAlpha(1f);
}
}
/**
@@ -128,7 +128,7 @@ public class BubbleDragAnimator {
boolean wasFling, boolean canceled, float finalValue, float finalVelocity,
boolean allRelevantPropertyAnimationsEnded) -> {
if (canceled || allRelevantPropertyAnimationsEnded) {
resetAnimatedViews(restingPosition);
resetAnimatedViews(restingPosition, /* dismissed= */ false);
if (endActions != null) {
endActions.run();
}
@@ -197,7 +197,7 @@ public class BubbleDragAnimator {
boolean wasFling, boolean canceled, float finalValue, float finalVelocity,
boolean allRelevantPropertyAnimationsEnded) -> {
if (canceled || allRelevantPropertyAnimationsEnded) {
resetAnimatedViews(initialPosition);
resetAnimatedViews(initialPosition, /* dismissed= */ true);
if (endActions != null) endActions.run();
}
})
@@ -208,11 +208,14 @@ public class BubbleDragAnimator {
* Reset the animated views to the initial state
*
* @param initialPosition position of the bubble
* @param dismissed whether the animated view was dismissed
*/
private void resetAnimatedViews(@NonNull PointF initialPosition) {
private void resetAnimatedViews(@NonNull PointF initialPosition, boolean dismissed) {
mView.setScaleX(1f);
mView.setScaleY(1f);
mView.setAlpha(1f);
if (!dismissed) {
mView.setAlpha(1f);
}
mView.setTranslationX(initialPosition.x);
mView.setTranslationY(initialPosition.y);