Merge changes I3cfdb715,Ic194afdb into main

* changes:
  Fix initial alpha when unstashing bubble bar
  Set additional bubble translation during stash
This commit is contained in:
Ats Jenk
2024-09-13 22:38:24 +00:00
committed by Android (Google) Code Review
5 changed files with 113 additions and 75 deletions
@@ -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.
*
@@ -997,10 +1010,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);
@@ -1134,6 +1144,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.
*/