Merge changes I65f46028,Ie3f67ccd into sc-dev
* changes: Make the pointer for bubbles expanded view rounded Update the manage button to the new style
This commit is contained in:
@@ -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>
|
||||||
@@ -28,15 +28,18 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<com.android.wm.shell.common.AlphaOptimizedButton
|
<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:id="@+id/settings_button"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:layout_width="wrap_content"
|
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:focusable="true"
|
||||||
android:text="@string/manage_bubbles_text"
|
android:text="@string/manage_bubbles_text"
|
||||||
android:textSize="@*android:dimen/text_size_body_2_material"
|
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>
|
</com.android.wm.shell.bubbles.BubbleExpandedView>
|
||||||
|
|||||||
@@ -139,10 +139,15 @@
|
|||||||
<dimen name="bubble_empty_overflow_image_height">200dp</dimen>
|
<dimen name="bubble_empty_overflow_image_height">200dp</dimen>
|
||||||
<!-- Padding of bubble overflow empty state subtitle -->
|
<!-- Padding of bubble overflow empty state subtitle -->
|
||||||
<dimen name="bubble_empty_overflow_subtitle_padding">50dp</dimen>
|
<dimen name="bubble_empty_overflow_subtitle_padding">50dp</dimen>
|
||||||
<!-- Height of the triangle that points to the expanded bubble -->
|
<!-- Height of the triangle that points to the expanded bubble. -->
|
||||||
<dimen name="bubble_pointer_height">8dp</dimen>
|
<dimen name="bubble_pointer_height">10dp</dimen>
|
||||||
<!-- Width of the triangle that points to the expanded bubble -->
|
<!-- Width of the triangle that points to the expanded bubble. -->
|
||||||
<dimen name="bubble_pointer_width">12dp</dimen>
|
<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 -->
|
<!-- Extra padding around the dismiss target for bubbles -->
|
||||||
<dimen name="bubble_dismiss_slop">16dp</dimen>
|
<dimen name="bubble_dismiss_slop">16dp</dimen>
|
||||||
<!-- Height of button allowing users to adjust settings for bubbles. -->
|
<!-- Height of button allowing users to adjust settings for bubbles. -->
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ import android.content.res.Resources;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.CornerPathEffect;
|
||||||
import android.graphics.Outline;
|
import android.graphics.Outline;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.graphics.Picture;
|
import android.graphics.Picture;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.ShapeDrawable;
|
import android.graphics.drawable.ShapeDrawable;
|
||||||
@@ -105,6 +107,9 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
private int mSettingsIconHeight;
|
private int mSettingsIconHeight;
|
||||||
private int mPointerWidth;
|
private int mPointerWidth;
|
||||||
private int mPointerHeight;
|
private int mPointerHeight;
|
||||||
|
private float mPointerRadius;
|
||||||
|
private float mPointerOverlap;
|
||||||
|
private CornerPathEffect mPointerEffect;
|
||||||
private ShapeDrawable mCurrentPointer;
|
private ShapeDrawable mCurrentPointer;
|
||||||
private ShapeDrawable mTopPointer;
|
private ShapeDrawable mTopPointer;
|
||||||
private ShapeDrawable mLeftPointer;
|
private ShapeDrawable mLeftPointer;
|
||||||
@@ -348,7 +353,9 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
|
mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
|
||||||
mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
|
mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
|
||||||
mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);
|
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(
|
mTopPointer = new ShapeDrawable(TriangleShape.create(
|
||||||
mPointerWidth, mPointerHeight, true /* pointUp */));
|
mPointerWidth, mPointerHeight, true /* pointUp */));
|
||||||
mLeftPointer = new ShapeDrawable(TriangleShape.createHorizontal(
|
mLeftPointer = new ShapeDrawable(TriangleShape.createHorizontal(
|
||||||
@@ -408,8 +415,12 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
lp.width = mPointerWidth;
|
lp.width = mPointerWidth;
|
||||||
lp.height = mPointerHeight;
|
lp.height = mPointerHeight;
|
||||||
}
|
}
|
||||||
mPointerView.setLayoutParams(lp);
|
|
||||||
mCurrentPointer.setTint(mBackgroundColorFloating);
|
mCurrentPointer.setTint(mBackgroundColorFloating);
|
||||||
|
|
||||||
|
Paint arrowPaint = mCurrentPointer.getPaint();
|
||||||
|
arrowPaint.setColor(mBackgroundColorFloating);
|
||||||
|
arrowPaint.setPathEffect(mPointerEffect);
|
||||||
|
mPointerView.setLayoutParams(lp);
|
||||||
mPointerView.setBackground(mCurrentPointer);
|
mPointerView.setBackground(mCurrentPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,11 +662,12 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
// Remove top insets back here because availableRect.height would account for that
|
// Remove top insets back here because availableRect.height would account for that
|
||||||
? mExpandedViewContainerLocation[1] - mPositioner.getInsets().top
|
? mExpandedViewContainerLocation[1] - mPositioner.getInsets().top
|
||||||
: 0;
|
: 0;
|
||||||
|
int settingsHeight = mIsOverflow ? 0 : mSettingsIconHeight;
|
||||||
return mPositioner.getAvailableRect().height()
|
return mPositioner.getAvailableRect().height()
|
||||||
- expandedContainerY
|
- expandedContainerY
|
||||||
- getPaddingTop()
|
- getPaddingTop()
|
||||||
- getPaddingBottom()
|
- getPaddingBottom()
|
||||||
- mSettingsIconHeight
|
- settingsHeight
|
||||||
- mPointerHeight
|
- mPointerHeight
|
||||||
- mPointerMargin;
|
- mPointerMargin;
|
||||||
}
|
}
|
||||||
@@ -700,10 +712,14 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
public void setPointerPosition(float bubblePosition, boolean onLeft) {
|
public void setPointerPosition(float bubblePosition, boolean onLeft) {
|
||||||
// Pointer gets drawn in the padding
|
// Pointer gets drawn in the padding
|
||||||
final boolean showVertically = mPositioner.showBubblesVertically();
|
final boolean showVertically = mPositioner.showBubblesVertically();
|
||||||
final int paddingLeft = (showVertically && onLeft) ? mPointerHeight : 0;
|
final float paddingLeft = (showVertically && onLeft)
|
||||||
final int paddingRight = (showVertically && !onLeft) ? mPointerHeight : 0;
|
? mPointerHeight - mPointerOverlap
|
||||||
final int paddingTop = showVertically ? 0 : mExpandedViewPadding;
|
: 0;
|
||||||
setPadding(paddingLeft, paddingTop, paddingRight, 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 expandedViewY = mPositioner.getExpandedViewY();
|
||||||
final float bubbleSize = mPositioner.getBubbleBitmapSize();
|
final float bubbleSize = mPositioner.getBubbleBitmapSize();
|
||||||
@@ -716,9 +732,11 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
float pointerX;
|
float pointerX;
|
||||||
if (showVertically) {
|
if (showVertically) {
|
||||||
pointerY = bubbleCenter - (mPointerWidth / 2f);
|
pointerY = bubbleCenter - (mPointerWidth / 2f);
|
||||||
pointerX = onLeft ? -mPointerHeight : getWidth() - mPaddingRight;
|
pointerX = onLeft
|
||||||
|
? -mPointerHeight + mPointerOverlap
|
||||||
|
: getWidth() - mPaddingRight - mPointerOverlap;
|
||||||
} else {
|
} else {
|
||||||
pointerY = 0;
|
pointerY = mPointerOverlap;
|
||||||
pointerX = bubbleCenter - mPaddingLeft - (mPointerWidth / 2f);
|
pointerX = bubbleCenter - mPaddingLeft - (mPointerWidth / 2f);
|
||||||
}
|
}
|
||||||
mPointerView.setTranslationY(pointerY);
|
mPointerView.setTranslationY(pointerY);
|
||||||
|
|||||||
Reference in New Issue
Block a user