summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Mady Mellor <madym@google.com> 2021-05-20 19:54:53 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-05-20 19:54:53 +0000
commit0abd3000eb6d33c78d942ad4c6477d0d7ba87325 (patch)
tree4b00a6b37b2dee88c06d5e8cd3c43435654d8720 /libs
parent8e22cab81fbb7c18e560574c7a1747be83dff9d7 (diff)
parent70e798e4744066238413ab0068d88d80d03977f7 (diff)
Merge changes I65f46028,Ie3f67ccd into sc-dev
* changes: Make the pointer for bubbles expanded view rounded Update the manage button to the new style
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml30
-rw-r--r--libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml9
-rw-r--r--libs/WindowManager/Shell/res/values/dimen.xml11
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java36
4 files changed, 71 insertions, 15 deletions
diff --git a/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml
new file mode 100644
index 000000000000..8710fb8ac69b
--- /dev/null
+++ b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid
+ android:color="@android:color/system_neutral1_900"
+ />
+ <corners android:radius="20dp" />
+
+ <padding
+ android:left="20dp"
+ android:right="20dp">
+ </padding>
+
+</shape> \ No newline at end of file
diff --git a/libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml b/libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml
index 33e009efd371..cd15f25877fd 100644
--- a/libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml
+++ b/libs/WindowManager/Shell/res/layout/bubble_expanded_view.xml
@@ -28,15 +28,18 @@
/>
<com.android.wm.shell.common.AlphaOptimizedButton
- style="@android:style/Widget.Material.Button.Borderless"
+ style="@android:style/Widget.DeviceDefault.Button.Borderless"
android:id="@+id/settings_button"
android:layout_gravity="start"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="40dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginLeft="8dp"
android:focusable="true"
android:text="@string/manage_bubbles_text"
android:textSize="@*android:dimen/text_size_body_2_material"
- android:textColor="?android:attr/textColorPrimary"
+ android:background="@drawable/bubble_manage_btn_bg"
+ android:textColor="@*android:color/system_neutral1_50"
/>
</com.android.wm.shell.bubbles.BubbleExpandedView>
diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml
index 9b1beb3c9ab5..f4c4d025908e 100644
--- a/libs/WindowManager/Shell/res/values/dimen.xml
+++ b/libs/WindowManager/Shell/res/values/dimen.xml
@@ -139,10 +139,15 @@
<dimen name="bubble_empty_overflow_image_height">200dp</dimen>
<!-- Padding of bubble overflow empty state subtitle -->
<dimen name="bubble_empty_overflow_subtitle_padding">50dp</dimen>
- <!-- Height of the triangle that points to the expanded bubble -->
- <dimen name="bubble_pointer_height">8dp</dimen>
- <!-- Width of the triangle that points to the expanded bubble -->
+ <!-- Height of the triangle that points to the expanded bubble. -->
+ <dimen name="bubble_pointer_height">10dp</dimen>
+ <!-- Width of the triangle that points to the expanded bubble. -->
<dimen name="bubble_pointer_width">12dp</dimen>
+ <!-- Radius of the pointer -->
+ <dimen name="bubble_pointer_radius">2dp</dimen>
+ <!-- The amount the pointer overlaps with the expanded view to be flush on an edge with
+ a radius. -->
+ <dimen name="bubble_pointer_overlap">1dp</dimen>
<!-- 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. -->
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
index 7755cc0e6aed..6a68b06527be 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
@@ -39,7 +39,9 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
+import android.graphics.CornerPathEffect;
import android.graphics.Outline;
+import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.Rect;
import android.graphics.drawable.ShapeDrawable;
@@ -105,6 +107,9 @@ public class BubbleExpandedView extends LinearLayout {
private int mSettingsIconHeight;
private int mPointerWidth;
private int mPointerHeight;
+ private float mPointerRadius;
+ private float mPointerOverlap;
+ private CornerPathEffect mPointerEffect;
private ShapeDrawable mCurrentPointer;
private ShapeDrawable mTopPointer;
private ShapeDrawable mLeftPointer;
@@ -348,7 +353,9 @@ public class BubbleExpandedView extends LinearLayout {
mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);
-
+ mPointerRadius = getResources().getDimensionPixelSize(R.dimen.bubble_pointer_radius);
+ mPointerEffect = new CornerPathEffect(mPointerRadius);
+ mPointerOverlap = getResources().getDimensionPixelSize(R.dimen.bubble_pointer_overlap);
mTopPointer = new ShapeDrawable(TriangleShape.create(
mPointerWidth, mPointerHeight, true /* pointUp */));
mLeftPointer = new ShapeDrawable(TriangleShape.createHorizontal(
@@ -408,8 +415,12 @@ public class BubbleExpandedView extends LinearLayout {
lp.width = mPointerWidth;
lp.height = mPointerHeight;
}
- mPointerView.setLayoutParams(lp);
mCurrentPointer.setTint(mBackgroundColorFloating);
+
+ Paint arrowPaint = mCurrentPointer.getPaint();
+ arrowPaint.setColor(mBackgroundColorFloating);
+ arrowPaint.setPathEffect(mPointerEffect);
+ mPointerView.setLayoutParams(lp);
mPointerView.setBackground(mCurrentPointer);
}
@@ -651,11 +662,12 @@ public class BubbleExpandedView extends LinearLayout {
// Remove top insets back here because availableRect.height would account for that
? mExpandedViewContainerLocation[1] - mPositioner.getInsets().top
: 0;
+ int settingsHeight = mIsOverflow ? 0 : mSettingsIconHeight;
return mPositioner.getAvailableRect().height()
- expandedContainerY
- getPaddingTop()
- getPaddingBottom()
- - mSettingsIconHeight
+ - settingsHeight
- mPointerHeight
- mPointerMargin;
}
@@ -700,10 +712,14 @@ public class BubbleExpandedView extends LinearLayout {
public void setPointerPosition(float bubblePosition, boolean onLeft) {
// Pointer gets drawn in the padding
final boolean showVertically = mPositioner.showBubblesVertically();
- final int paddingLeft = (showVertically && onLeft) ? mPointerHeight : 0;
- final int paddingRight = (showVertically && !onLeft) ? mPointerHeight : 0;
- final int paddingTop = showVertically ? 0 : mExpandedViewPadding;
- setPadding(paddingLeft, paddingTop, paddingRight, 0);
+ final float paddingLeft = (showVertically && onLeft)
+ ? mPointerHeight - mPointerOverlap
+ : 0;
+ final float paddingRight = (showVertically && !onLeft)
+ ? mPointerHeight - mPointerOverlap : 0;
+ final int paddingTop = showVertically ? 0
+ : mExpandedViewPadding;
+ setPadding((int) paddingLeft, paddingTop, (int) paddingRight, 0);
final float expandedViewY = mPositioner.getExpandedViewY();
final float bubbleSize = mPositioner.getBubbleBitmapSize();
@@ -716,9 +732,11 @@ public class BubbleExpandedView extends LinearLayout {
float pointerX;
if (showVertically) {
pointerY = bubbleCenter - (mPointerWidth / 2f);
- pointerX = onLeft ? -mPointerHeight : getWidth() - mPaddingRight;
+ pointerX = onLeft
+ ? -mPointerHeight + mPointerOverlap
+ : getWidth() - mPaddingRight - mPointerOverlap;
} else {
- pointerY = 0;
+ pointerY = mPointerOverlap;
pointerX = bubbleCenter - mPaddingLeft - (mPointerWidth / 2f);
}
mPointerView.setTranslationY(pointerY);