From 750cf17edbaa1aaa7fa51a48443906dcf7bfe162 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Mon, 2 Aug 2021 11:34:25 -0700 Subject: [PATCH] Update width of expanded view to match new spec And remove something unused. Test: manual - expand bubble on large screen, note that size of expanded view is ~72% of screen - check that it's the full width on phone Bug: 193910391 Change-Id: I4c2060d84db10b5b0d8f30e2530c743d6045486e --- libs/WindowManager/Shell/res/values/dimen.xml | 2 +- .../wm/shell/bubbles/BubblePositioner.java | 21 ++++++++++++------- .../ExpandedAnimationController.java | 3 --- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index 757e83a25319e..130f741def864 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -124,7 +124,7 @@ should also be updated. --> 180dp - 412dp + 412dp 30dp diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java index 6cff05542aa47..7d4fb21584c76 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java @@ -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; } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java index efe07fbf108df..007ddbf631416 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java @@ -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.