Merge "Update width of expanded view to match new spec" into sc-v2-dev

This commit is contained in:
Mady Mellor
2021-08-10 20:17:50 +00:00
committed by Android (Google) Code Review
3 changed files with 15 additions and 11 deletions

View File

@@ -124,7 +124,7 @@
should also be updated. -->
<dimen name="bubble_expanded_default_height">180dp</dimen>
<!-- On large screens the width of the expanded view is restricted to this size. -->
<dimen name="bubble_expanded_view_tablet_width">412dp</dimen>
<dimen name="bubble_expanded_view_phone_landscape_overflow_width">412dp</dimen>
<!-- Inset to apply to the icon in the overflow button. -->
<dimen name="bubble_overflow_icon_inset">30dp</dimen>
<!-- Default (and minimum) height of bubble overflow -->

View File

@@ -65,7 +65,8 @@ public class BubblePositioner {
public static final float FLYOUT_MAX_WIDTH_PERCENT_LARGE_SCREEN = 0.3f;
/** The max percent of screen width to use for the flyout on phone. */
public static final float FLYOUT_MAX_WIDTH_PERCENT = 0.6f;
/** The percent of screen width that should be used for the expanded view on a large screen. **/
public static final float EXPANDED_VIEW_LARGE_SCREEN_WIDTH_PERCENT = 0.72f;
private Context mContext;
private WindowManager mWindowManager;
@@ -78,7 +79,8 @@ public class BubblePositioner {
private int mBubbleSize;
private int mSpacingBetweenBubbles;
private int mExpandedViewLargeScreenWidth;
private float mExpandedViewLargeScreenWidth;
private int mOverflowWidth;
private int mExpandedViewPadding;
private int mPointerMargin;
private int mPointerWidth;
@@ -166,9 +168,11 @@ public class BubblePositioner {
mBubbleSize = res.getDimensionPixelSize(R.dimen.bubble_size);
mSpacingBetweenBubbles = res.getDimensionPixelSize(R.dimen.bubble_spacing);
mDefaultMaxBubbles = res.getInteger(R.integer.bubbles_max_rendered);
mExpandedViewLargeScreenWidth = res.getDimensionPixelSize(
R.dimen.bubble_expanded_view_tablet_width);
mExpandedViewLargeScreenWidth = bounds.width() * EXPANDED_VIEW_LARGE_SCREEN_WIDTH_PERCENT;
mOverflowWidth = mIsLargeScreen
? (int) mExpandedViewLargeScreenWidth
: res.getDimensionPixelSize(
R.dimen.bubble_expanded_view_phone_landscape_overflow_width);
mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);
@@ -299,16 +303,19 @@ public class BubblePositioner {
int leftPadding = mInsets.left + mExpandedViewPadding;
int rightPadding = mInsets.right + mExpandedViewPadding;
final boolean isLargeOrOverflow = mIsLargeScreen || isOverflow;
final float expandedViewWidth = isOverflow
? mOverflowWidth
: mExpandedViewLargeScreenWidth;
if (showBubblesVertically()) {
if (!onLeft) {
rightPadding += mBubbleSize - mPointerHeight;
leftPadding += isLargeOrOverflow
? (mPositionRect.width() - rightPadding - mExpandedViewLargeScreenWidth)
? (mPositionRect.width() - rightPadding - expandedViewWidth)
: 0;
} else {
leftPadding += mBubbleSize - mPointerHeight;
rightPadding += isLargeOrOverflow
? (mPositionRect.width() - leftPadding - mExpandedViewLargeScreenWidth)
? (mPositionRect.width() - leftPadding - expandedViewWidth)
: 0;
}
}

View File

@@ -64,9 +64,6 @@ public class ExpandedAnimationController
/** Stiffness for the expand/collapse path-following animation. */
private static final int EXPAND_COLLAPSE_ANIM_STIFFNESS = 1000;
/** What percentage of the screen to use when centering the bubbles in landscape. */
private static final float CENTER_BUBBLES_LANDSCAPE_PERCENT = 0.66f;
/**
* Velocity required to dismiss an individual bubble without dragging it into the dismiss
* target.