Set additional bubble translation during stash

Fixes bubbles stash translation not getting cleared up after stash
animation finishes.

Bubbles are clipped using an outline animator during the stash
animation. They need separate translation applied to keep them within
the bounds of the bubble bar that is also shrinking and moving.

Set the translation for the bubbles in the stash controller so we can
reset the translation after the animation has finished.

Bug: 365829293
Flag: com.android.wm.shell.enable_bubble_bar
Test: TransientBubbleStashControllerTest
Test: have bubbles in bubble bar, trigger a new auto expanding bubble,
  check translation for bubbles
Change-Id: Ic194afdb4d650fcd525355d8bae08dd651d1ea05
This commit is contained in:
Ats Jenk
2024-09-11 10:24:05 -07:00
parent d72a0400eb
commit aad71bc532
5 changed files with 75 additions and 58 deletions
@@ -18,11 +18,8 @@ package com.android.launcher3.taskbar.bubbles;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static com.android.launcher3.taskbar.bubbles.BubbleView.STASH_TRANSLATION_Y;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.PointF;
@@ -97,6 +94,8 @@ public class BubbleBarViewController {
this::updateBackgroundScaleY);
private final AnimatedFloat mBubbleBarTranslationY = new AnimatedFloat(
this::updateTranslationY);
private final AnimatedFloat mBubbleOffsetY = new AnimatedFloat(
this::updateBubbleOffsetY);
// Modified when swipe up is happening on the bubble bar or task bar.
private float mBubbleBarSwipeUpTranslationY;
@@ -299,6 +298,10 @@ public class BubbleBarViewController {
return mBubbleBarTranslationY;
}
public AnimatedFloat getBubbleOffsetY() {
return mBubbleOffsetY;
}
public float getBubbleBarCollapsedWidth() {
return mBarView.collapsedWidth();
}
@@ -576,6 +579,10 @@ public class BubbleBarViewController {
mBarView.setBubbleAlpha(alpha);
}
private void updateBubbleOffsetY(float transY) {
mBarView.setBubbleOffsetY(transY);
}
private void updateBackgroundAlpha(float alpha) {
mBarView.setBackgroundAlpha(alpha);
}
@@ -874,14 +881,9 @@ public class BubbleBarViewController {
mBubbleStashController.getHandleBounds(stashedHandleBounds);
int childCount = mBarView.getChildCount();
float newChildWidth = (float) stashedHandleBounds.width() / childCount;
float stashTranslationY = -mBubbleStashController.getBubbleBarTranslationY();
AnimatorSet animatorSet = new AnimatorSet();
for (int i = 0; i < childCount; i++) {
BubbleView child = (BubbleView) mBarView.getChildAt(i);
final float startTransY = isStashed ? 0f : stashTranslationY;
final float endTransY = isStashed ? stashTranslationY : 0f;
animatorSet.play(
ObjectAnimator.ofFloat(child, STASH_TRANSLATION_Y, startTransY, endTransY));
animatorSet.play(
createRevealAnimForBubble(child, isStashed, stashedHandleBounds,
newChildWidth));