Merge "Update stack design with vertical offset"

This commit is contained in:
Lyn Han
2020-10-14 18:01:11 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 9 deletions

View File

@@ -1217,7 +1217,7 @@
<!-- Interior padding of the message bubble -->
<dimen name="bubble_message_padding">4dp</dimen>
<!-- Offset between bubbles in their stacked position. -->
<dimen name="bubble_stack_offset">5dp</dimen>
<dimen name="bubble_stack_offset">10dp</dimen>
<!-- How far offscreen the bubble stack rests. Cuts off padding and part of icon bitmap. -->
<dimen name="bubble_stack_offscreen">9dp</dimen>
<!-- How far down the screen the stack starts. -->

View File

@@ -274,16 +274,14 @@ public class ExpandedAnimationController
// Then, draw a line across the screen to the bubble's resting position.
path.lineTo(getBubbleLeft(index), expandedY);
} else {
final float sideMultiplier =
mLayout.isFirstChildXLeftOfCenter(mCollapsePoint.x) ? -1 : 1;
final float stackedX = mCollapsePoint.x + (sideMultiplier * index * mStackOffsetPx);
final float stackedX = mCollapsePoint.x;
// If we're collapsing, draw a line from the bubble's current position to the side
// of the screen where the bubble will be stacked.
path.lineTo(stackedX, expandedY);
// Then, draw a line down to the stack position.
path.lineTo(stackedX, mCollapsePoint.y);
path.lineTo(stackedX, mCollapsePoint.y + index * mStackOffsetPx);
}
// The lead bubble should be the bubble with the longest distance to travel when we're

View File

@@ -744,15 +744,13 @@ public class StackAnimationController extends
@Override
float getOffsetForChainedPropertyAnimation(DynamicAnimation.ViewProperty property) {
if (property.equals(DynamicAnimation.TRANSLATION_X)) {
if (property.equals(DynamicAnimation.TRANSLATION_Y)) {
// If we're in the dismiss target, have the bubbles pile on top of each other with no
// offset.
if (isStackStuckToTarget()) {
return 0f;
} else {
// Offset to the left if we're on the left, or the right otherwise.
return mLayout.isFirstChildXLeftOfCenter(mStackPosition.x)
? -mStackOffset : mStackOffset;
return mStackOffset;
}
} else {
return 0f;