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
@@ -27,7 +27,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.LayoutInflater;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ImageView;
@@ -50,27 +49,12 @@ public class BubbleView extends ConstraintLayout {
public static final int DEFAULT_PATH_SIZE = 100;
public static FloatProperty<BubbleView> STASH_TRANSLATION_Y = new FloatProperty<>(
"stashTranslationY") {
@Override
public void setValue(BubbleView bubbleView, float transY) {
bubbleView.setStashTranslationY(transY);
}
@Override
public Float get(BubbleView bubbleView) {
return bubbleView.mStashTranslationY;
}
};
private final ImageView mBubbleIcon;
private final ImageView mAppIcon;
private int mBubbleSize;
private float mDragTranslationX;
private float mOffsetX;
private float mTranslationY;
private float mStashTranslationY;
private DotRenderer mDotRenderer;
private DotRenderer.DrawParams mDrawParams;
@@ -177,24 +161,6 @@ public class BubbleView extends ConstraintLayout {
setTranslationX(mDragTranslationX + mOffsetX);
}
/**
* Set translation in y direction during stash and unstash from handle
*/
public void setStashTranslationY(float translationY) {
mStashTranslationY = translationY;
applyTranslationY();
}
@Override
public void setTranslationY(float translationY) {
mTranslationY = translationY;
applyTranslationY();
}
private void applyTranslationY() {
super.setTranslationY(mTranslationY + mStashTranslationY);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);