Merge changes I65f46028,Ie3f67ccd into sc-dev am: 0abd3000eb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14626183

Change-Id: I51699d2f9f212e921c67cf30ef336efe4866f121
This commit is contained in:
Mady Mellor
2021-05-20 20:01:41 +00:00
committed by Automerger Merge Worker
4 changed files with 71 additions and 15 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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. -->

View File

@@ -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);