Update the sizes for bubble expanded view
* 16dp on either side / from edge of screen for the bubble view
* 16dp between bubble row & expanded bubble rect (works out to 5dp
in code: 16dp - 2dp (badge overhang) - 9dp (pointer height)
* max 8dp between the bubbles in the top row
* manage button has some adjustments - 8dp above & below and is total
32dp from edge of screen; ensure manage button is centered between
bottom inset & bottom of expanded view
* fixes a bug where there was extra padding being at top of expanded
view in landscape mode
* removed an unused layout file & unused dimens
Test: visual - expand a bubble, look at spacing of everything on
screen; do the same in landscape from left and right
edges of the screen.
Bug: 187715439
Bug: 183658029
Change-Id: I29e699aaf9b6e7bf75447dac6aa6b00a7b272b8b
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:focusable="true"
|
||||
android:text="@string/manage_bubbles_text"
|
||||
android:textSize="@*android:dimen/text_size_body_2_material"
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2019 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<com.android.wm.shell.bubbles.BubbleMenuView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:background="#66000000"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/bubble_menu_container"
|
||||
tools:ignore="MissingClass">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_height="@dimen/bubble_menu_item_height"
|
||||
android:layout_width="wrap_content"
|
||||
android:background="#FFFFFF"
|
||||
android:id="@+id/bubble_menu_view">
|
||||
|
||||
<ImageView
|
||||
android:id="@*android:id/icon"
|
||||
android:layout_width="@dimen/bubble_grid_item_icon_width"
|
||||
android:layout_height="@dimen/bubble_grid_item_icon_height"
|
||||
android:layout_marginTop="@dimen/bubble_grid_item_icon_top_margin"
|
||||
android:layout_marginBottom="@dimen/bubble_grid_item_icon_bottom_margin"
|
||||
android:layout_marginLeft="@dimen/bubble_grid_item_icon_side_margin"
|
||||
android:layout_marginRight="@dimen/bubble_grid_item_icon_side_margin"
|
||||
android:scaleType="centerInside"
|
||||
android:tint="@color/bubbles_icon_tint"
|
||||
/>
|
||||
</FrameLayout>
|
||||
</com.android.wm.shell.bubbles.BubbleMenuView>
|
||||
@@ -85,13 +85,6 @@
|
||||
<!-- The amount to inset the drop target regions from the edge of the display -->
|
||||
<dimen name="drop_layout_display_margin">16dp</dimen>
|
||||
|
||||
<!-- The menu grid size for bubble menu. -->
|
||||
<dimen name="bubble_grid_item_icon_width">20dp</dimen>
|
||||
<dimen name="bubble_grid_item_icon_height">20dp</dimen>
|
||||
<dimen name="bubble_grid_item_icon_top_margin">12dp</dimen>
|
||||
<dimen name="bubble_grid_item_icon_bottom_margin">4dp</dimen>
|
||||
<dimen name="bubble_grid_item_icon_side_margin">22dp</dimen>
|
||||
|
||||
<!-- How much each bubble is elevated. -->
|
||||
<dimen name="bubble_elevation">1dp</dimen>
|
||||
<!-- How much the bubble flyout text container is elevated. -->
|
||||
@@ -109,7 +102,7 @@
|
||||
<!-- Padding between status bar and bubbles when displayed in expanded state -->
|
||||
<dimen name="bubble_padding_top">16dp</dimen>
|
||||
<!-- Max amount of space between bubbles when expanded. -->
|
||||
<dimen name="bubble_max_spacing">16dp</dimen>
|
||||
<dimen name="bubble_max_spacing">8dp</dimen>
|
||||
<!-- Size of individual bubbles. -->
|
||||
<dimen name="individual_bubble_size">60dp</dimen>
|
||||
<!-- Size of bubble bitmap. -->
|
||||
@@ -119,7 +112,7 @@
|
||||
<!-- Size of the circle around the bubbles when they're in the dismiss target. -->
|
||||
<dimen name="bubble_dismiss_encircle_size">52dp</dimen>
|
||||
<!-- Padding around the view displayed when the bubble is expanded -->
|
||||
<dimen name="bubble_expanded_view_padding">4dp</dimen>
|
||||
<dimen name="bubble_expanded_view_padding">16dp</dimen>
|
||||
<!-- This should be at least the size of bubble_expanded_view_padding; it is used to include
|
||||
a slight touch slop around the expanded view. -->
|
||||
<dimen name="bubble_expanded_view_slop">8dp</dimen>
|
||||
@@ -151,7 +144,7 @@
|
||||
<!-- Extra padding around the dismiss target for bubbles -->
|
||||
<dimen name="bubble_dismiss_slop">16dp</dimen>
|
||||
<!-- Height of button allowing users to adjust settings for bubbles. -->
|
||||
<dimen name="bubble_manage_button_height">48dp</dimen>
|
||||
<dimen name="bubble_manage_button_height">56dp</dimen>
|
||||
<!-- Height of an item in the bubble manage menu. -->
|
||||
<dimen name="bubble_menu_item_height">60dp</dimen>
|
||||
<!-- Max width of the message bubble-->
|
||||
@@ -170,7 +163,7 @@
|
||||
<!-- How far down the screen the stack starts. -->
|
||||
<dimen name="bubble_stack_starting_offset_y">120dp</dimen>
|
||||
<!-- Space between the pointer triangle and the bubble expanded view -->
|
||||
<dimen name="bubble_pointer_margin">8dp</dimen>
|
||||
<dimen name="bubble_pointer_margin">5dp</dimen>
|
||||
<!-- Padding applied to the bubble dismiss target. Touches in this padding cause the bubbles to
|
||||
snap to the dismiss target. -->
|
||||
<dimen name="bubble_dismiss_target_padding_x">40dp</dimen>
|
||||
|
||||
@@ -113,7 +113,6 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
private ShapeDrawable mTopPointer;
|
||||
private ShapeDrawable mLeftPointer;
|
||||
private ShapeDrawable mRightPointer;
|
||||
private int mExpandedViewPadding;
|
||||
private float mCornerRadius = 0f;
|
||||
private int mBackgroundColorFloating;
|
||||
|
||||
@@ -349,7 +348,6 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
Resources res = getResources();
|
||||
mMinHeight = res.getDimensionPixelSize(R.dimen.bubble_expanded_default_height);
|
||||
mOverflowHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height);
|
||||
mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
|
||||
|
||||
updateFontSize();
|
||||
|
||||
@@ -667,13 +665,15 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
? mExpandedViewContainerLocation[1] - mPositioner.getInsets().top
|
||||
: 0;
|
||||
int settingsHeight = mIsOverflow ? 0 : mManageButtonHeight;
|
||||
int pointerHeight = mPositioner.showBubblesVertically()
|
||||
? mPointerWidth
|
||||
: (int) (mPointerHeight - mPointerOverlap + mPointerMargin);
|
||||
return mPositioner.getAvailableRect().height()
|
||||
- expandedContainerY
|
||||
- getPaddingTop()
|
||||
- getPaddingBottom()
|
||||
- settingsHeight
|
||||
- mPointerHeight
|
||||
- mPointerMargin;
|
||||
- pointerHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -721,15 +721,14 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
: 0;
|
||||
final float paddingRight = (showVertically && !onLeft)
|
||||
? mPointerHeight - mPointerOverlap : 0;
|
||||
final int paddingTop = showVertically ? 0
|
||||
: mExpandedViewPadding;
|
||||
setPadding((int) paddingLeft, paddingTop, (int) paddingRight, 0);
|
||||
final float paddingTop = showVertically ? 0
|
||||
: mPointerHeight - mPointerOverlap;
|
||||
setPadding((int) paddingLeft, (int) paddingTop, (int) paddingRight, 0);
|
||||
|
||||
final float expandedViewY = mPositioner.getExpandedViewY();
|
||||
final float bubbleSize = mPositioner.getBubbleBitmapSize();
|
||||
final float bubbleCenter = showVertically
|
||||
? bubblePosition + (bubbleSize / 2f) - expandedViewY
|
||||
: bubblePosition + (bubbleSize / 2f);
|
||||
? bubblePosition + (mPositioner.getBubbleSize() / 2f) - expandedViewY
|
||||
: bubblePosition + (mPositioner.getBubbleBitmapSize() / 2f) - mPointerWidth;
|
||||
// Post because we need the width of the view
|
||||
post(() -> {
|
||||
float pointerY;
|
||||
@@ -741,7 +740,7 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
: getWidth() - mPaddingRight - mPointerOverlap;
|
||||
} else {
|
||||
pointerY = mPointerOverlap;
|
||||
pointerX = bubbleCenter - mPaddingLeft - (mPointerWidth / 2f);
|
||||
pointerX = bubbleCenter - (mPointerWidth / 2f);
|
||||
}
|
||||
mPointerView.setTranslationY(pointerY);
|
||||
mPointerView.setTranslationX(pointerX);
|
||||
|
||||
@@ -72,12 +72,13 @@ public class BubblePositioner {
|
||||
private int mBubbleBitmapSize;
|
||||
private int mExpandedViewLargeScreenWidth;
|
||||
private int mExpandedViewPadding;
|
||||
private int mPointerHeight;
|
||||
private int mBubblePaddingTop;
|
||||
private int mPointerMargin;
|
||||
private float mPointerWidth;
|
||||
private float mPointerHeight;
|
||||
|
||||
private PointF mPinLocation;
|
||||
private PointF mRestingStackPosition;
|
||||
private int[] mLeftRightPadding = new int[2];
|
||||
private int[] mPaddings = new int[4];
|
||||
|
||||
private boolean mIsLargeScreen;
|
||||
private boolean mShowingInTaskbar;
|
||||
@@ -154,8 +155,9 @@ public class BubblePositioner {
|
||||
mExpandedViewLargeScreenWidth = res.getDimensionPixelSize(
|
||||
R.dimen.bubble_expanded_view_tablet_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);
|
||||
mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top);
|
||||
mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
|
||||
if (mShowingInTaskbar) {
|
||||
adjustForTaskbar();
|
||||
}
|
||||
@@ -251,30 +253,32 @@ public class BubblePositioner {
|
||||
final boolean isLargeOrOverflow = mIsLargeScreen || isOverflow;
|
||||
if (showBubblesVertically()) {
|
||||
if (!onLeft) {
|
||||
rightPadding += mPointerHeight + mBubbleSize;
|
||||
rightPadding += mBubbleSize - mPointerHeight;
|
||||
leftPadding += isLargeOrOverflow
|
||||
? (mPositionRect.width() - rightPadding - mExpandedViewLargeScreenWidth)
|
||||
: 0;
|
||||
} else {
|
||||
//TODO: pointer height should be padding between pointer & bubbles here & above
|
||||
leftPadding += mPointerHeight + mBubbleSize;
|
||||
leftPadding += mBubbleSize - mPointerHeight;
|
||||
rightPadding += isLargeOrOverflow
|
||||
? (mPositionRect.width() - leftPadding - mExpandedViewLargeScreenWidth)
|
||||
: 0;
|
||||
}
|
||||
}
|
||||
mLeftRightPadding[0] = leftPadding;
|
||||
mLeftRightPadding[1] = rightPadding;
|
||||
return mLeftRightPadding;
|
||||
// [left, top, right, bottom]
|
||||
mPaddings[0] = leftPadding;
|
||||
mPaddings[1] = showBubblesVertically() ? 0 : mPointerMargin;
|
||||
mPaddings[2] = rightPadding;
|
||||
mPaddings[3] = 0;
|
||||
return mPaddings;
|
||||
}
|
||||
|
||||
/** Calculates the y position of the expanded view when it is expanded. */
|
||||
public float getExpandedViewY() {
|
||||
final int top = getAvailableRect().top;
|
||||
if (showBubblesVertically()) {
|
||||
return top + mExpandedViewPadding;
|
||||
return top - mPointerWidth;
|
||||
} else {
|
||||
return top + mBubbleSize + mBubblePaddingTop;
|
||||
return top + mBubbleSize + mPointerMargin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,6 @@ public class BubbleStackView extends FrameLayout
|
||||
private int mBubbleElevation;
|
||||
private int mBubbleTouchPadding;
|
||||
private int mExpandedViewPadding;
|
||||
private int mPointerHeight;
|
||||
private int mCornerRadius;
|
||||
private int mImeOffset;
|
||||
@Nullable private BubbleViewProvider mExpandedBubble;
|
||||
@@ -767,7 +766,6 @@ public class BubbleStackView extends FrameLayout
|
||||
mBubbleSize = res.getDimensionPixelSize(R.dimen.individual_bubble_size);
|
||||
mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation);
|
||||
mBubbleTouchPadding = res.getDimensionPixelSize(R.dimen.bubble_touch_padding);
|
||||
mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);
|
||||
mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset);
|
||||
|
||||
mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
|
||||
@@ -2700,7 +2698,7 @@ public class BubbleStackView extends FrameLayout
|
||||
&& BubbleOverflow.KEY.equals(mExpandedBubble.getKey());
|
||||
int[] paddings = mPositioner.getExpandedViewPadding(
|
||||
mStackAnimationController.isStackOnLeftSide(), isOverflowExpanded);
|
||||
mExpandedViewContainer.setPadding(paddings[0], 0, paddings[1], 0);
|
||||
mExpandedViewContainer.setPadding(paddings[0], paddings[1], paddings[2], paddings[3]);
|
||||
if (mIsExpansionAnimating) {
|
||||
mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,6 @@ public class ExpandedAnimationController
|
||||
Resources res = mLayout.getContext().getResources();
|
||||
mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top);
|
||||
mStackOffsetPx = res.getDimensionPixelSize(R.dimen.bubble_stack_offset);
|
||||
mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top);
|
||||
mBubbleSizePx = mPositioner.getBubbleSize();
|
||||
mBubblesMaxRendered = res.getInteger(R.integer.bubbles_max_rendered);
|
||||
mBubblesMaxSpace = res.getDimensionPixelSize(R.dimen.bubble_max_spacing);
|
||||
@@ -276,8 +275,8 @@ public class ExpandedAnimationController
|
||||
boolean onLeft = mCollapsePoint != null
|
||||
&& mCollapsePoint.x < (availableRect.width() / 2f);
|
||||
float translationX = onLeft
|
||||
? availableRect.left + mExpandedViewPadding
|
||||
: availableRect.right - mBubbleSizePx - mExpandedViewPadding;
|
||||
? availableRect.left
|
||||
: availableRect.right - mBubbleSizePx;
|
||||
path.lineTo(translationX, getBubbleXOrYForOrientation(index));
|
||||
} else {
|
||||
path.lineTo(getBubbleXOrYForOrientation(index), expandedY);
|
||||
@@ -621,8 +620,8 @@ public class ExpandedAnimationController
|
||||
&& mCollapsePoint.x < (availableRect.width() / 2f);
|
||||
animationForChild(bubble)
|
||||
.translationX(onLeft
|
||||
? availableRect.left + mExpandedViewPadding
|
||||
: availableRect.right - mBubbleSizePx - mExpandedViewPadding)
|
||||
? availableRect.left
|
||||
: availableRect.right - mBubbleSizePx)
|
||||
.translationY(getBubbleXOrYForOrientation(i))
|
||||
.start();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user