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:
1 parent
d72a0400eb
commit
aad71bc532
5 files changed
+75
-58
No files matched your search
@@ -187,6 +187,9 @@ public class BubbleBarView extends FrameLayout {
|
||||
private BubbleView mDismissedByDragBubbleView;
|
||||
private float mAlphaDuringDrag = 1f;
|
||||
|
||||
/** Additional translation in the y direction that is applied to each bubble */
|
||||
private float mBubbleOffsetY;
|
||||
|
||||
private Controller mController;
|
||||
|
||||
private int mPreviousLayoutDirection = LayoutDirection.UNDEFINED;
|
||||
@@ -334,6 +337,16 @@ public class BubbleBarView extends FrameLayout {
|
||||
mBubbleBarBackground.setAlpha((int) (255 * alpha));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets offset of each bubble view in the y direction from the base position in the bar.
|
||||
*/
|
||||
public void setBubbleOffsetY(float offsetY) {
|
||||
mBubbleOffsetY = offsetY;
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
getChildAt(i).setTranslationY(getBubbleTranslationY());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets new icon sizes and newBubbleBarPadding between icons and bubble bar borders.
|
||||
*
|
||||
@@ -994,10 +1007,7 @@ public class BubbleBarView extends FrameLayout {
|
||||
final float expandedWidth = expandedWidth();
|
||||
final float collapsedWidth = collapsedWidth();
|
||||
int childCount = getChildCount();
|
||||
float viewBottom = mBubbleBarBounds.height() + (isExpanded() ? mPointerSize : 0);
|
||||
float bubbleBarAnimatedTop = viewBottom - getBubbleBarHeight();
|
||||
// When translating X & Y the scale is ignored, so need to deduct it from the translations
|
||||
final float ty = bubbleBarAnimatedTop + mBubbleBarPadding - getScaleIconShift();
|
||||
final float ty = getBubbleTranslationY();
|
||||
final boolean onLeft = bubbleBarLocation.isOnLeft(isLayoutRtl());
|
||||
// elevation state is opposite to widthState - when expanded all icons are flat
|
||||
float elevationState = (1 - widthState);
|
||||
@@ -1131,6 +1141,13 @@ public class BubbleBarView extends FrameLayout {
|
||||
return mBubbleBarPadding + translationX - getScaleIconShift();
|
||||
}
|
||||
|
||||
private float getBubbleTranslationY() {
|
||||
float viewBottom = mBubbleBarBounds.height() + (isExpanded() ? mPointerSize : 0);
|
||||
float bubbleBarAnimatedTop = viewBottom - getBubbleBarHeight();
|
||||
// When translating X & Y the scale is ignored, so need to deduct it from the translations
|
||||
return mBubbleOffsetY + bubbleBarAnimatedTop + mBubbleBarPadding - getScaleIconShift();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorders the views to match the provided list.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user