diff options
8 files changed, 81 insertions, 44 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 index 96d2d7c954d8..d2360e9b1ae0 100644 --- a/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml +++ b/libs/WindowManager/Shell/res/drawable/bubble_manage_btn_bg.xml @@ -16,9 +16,10 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:shape="rectangle"> <solid - android:color="@android:color/system_neutral1_800" + android:color="?androidprv:attr/materialColorSurfaceContainerHigh" /> <corners android:radius="20dp" /> diff --git a/libs/WindowManager/Shell/res/drawable/bubble_manage_menu_bg.xml b/libs/WindowManager/Shell/res/drawable/bubble_manage_menu_bg.xml index 4bd2f134d027..8fd2e68f6451 100644 --- a/libs/WindowManager/Shell/res/drawable/bubble_manage_menu_bg.xml +++ b/libs/WindowManager/Shell/res/drawable/bubble_manage_menu_bg.xml @@ -17,7 +17,7 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:shape="rectangle"> - <solid android:color="?androidprv:attr/colorSurface" /> + <solid android:color="?androidprv:attr/materialColorSurfaceBright" /> <corners android:bottomLeftRadius="?android:attr/dialogCornerRadius" android:topLeftRadius="?android:attr/dialogCornerRadius" diff --git a/libs/WindowManager/Shell/res/layout/bubble_flyout.xml b/libs/WindowManager/Shell/res/layout/bubble_flyout.xml index 7fdf290efd09..65a07a718677 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_flyout.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_flyout.xml @@ -13,7 +13,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<merge xmlns:android="http://schemas.android.com/apk/res/android"> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> <LinearLayout android:id="@+id/bubble_flyout_text_container" @@ -48,6 +49,7 @@ android:fontFamily="@*android:string/config_bodyFontFamilyMedium" android:maxLines="1" android:ellipsize="end" + android:textColor="?androidprv:attr/materialColorOnSurface" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"/> <TextView @@ -57,6 +59,7 @@ android:fontFamily="@*android:string/config_bodyFontFamily" android:maxLines="2" android:ellipsize="end" + android:textColor="?androidprv:attr/materialColorOnSurfaceVariant" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"/> </LinearLayout> diff --git a/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml b/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml index 0cf6d73162d2..f88d63d796ea 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml @@ -16,6 +16,7 @@ --> <com.android.wm.shell.common.AlphaOptimizedButton xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" style="@android:style/Widget.DeviceDefault.Button.Borderless" android:id="@+id/manage_button" android:layout_gravity="start" @@ -27,6 +28,6 @@ android:focusable="true" android:text="@string/manage_bubbles_text" android:textSize="@*android:dimen/text_size_body_2_material" - android:textColor="@*android:color/system_neutral1_50" + android:textColor="?androidprv:attr/materialColorOnSurface" android:background="@drawable/bubble_manage_btn_bg" />
\ No newline at end of file diff --git a/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml b/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml index 298ad3025b00..10c9562cf651 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml @@ -15,6 +15,7 @@ ~ limitations under the License --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bubble_manage_menu_bg" @@ -41,6 +42,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:textColor="?androidprv:attr/materialColorOnSurface" android:textAppearance="@*android:style/TextAppearance.DeviceDefault" android:text="@string/bubble_dismiss_text" /> @@ -66,6 +68,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:textColor="?androidprv:attr/materialColorOnSurface" android:textAppearance="@*android:style/TextAppearance.DeviceDefault" android:text="@string/bubbles_dont_bubble_conversation" /> @@ -92,6 +95,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" + android:textColor="?androidprv:attr/materialColorOnSurface" android:textAppearance="@*android:style/TextAppearance.DeviceDefault" /> </LinearLayout> diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java index f878a46d26f2..6a5f785504c0 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleFlyoutView.java @@ -177,7 +177,7 @@ public class BubbleFlyoutView extends FrameLayout { final TypedArray ta = mContext.obtainStyledAttributes( new int[] { - com.android.internal.R.attr.colorSurface, + com.android.internal.R.attr.materialColorSurfaceContainer, android.R.attr.dialogCornerRadius}); mFloatingBackgroundColor = ta.getColor(0, Color.WHITE); mCornerRadius = ta.getDimensionPixelSize(1, 0); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt index c49451df31b4..df7f5b4f0150 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt @@ -19,23 +19,21 @@ package com.android.wm.shell.bubbles import android.app.ActivityTaskManager.INVALID_TASK_ID import android.content.Context import android.graphics.Bitmap +import android.graphics.Color import android.graphics.Matrix import android.graphics.Path import android.graphics.drawable.AdaptiveIconDrawable import android.graphics.drawable.ColorDrawable import android.graphics.drawable.InsetDrawable import android.util.PathParser -import android.util.TypedValue import android.view.LayoutInflater import android.widget.FrameLayout import com.android.launcher3.icons.BubbleIconFactory import com.android.wm.shell.R import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView -class BubbleOverflow( - private val context: Context, - private val positioner: BubblePositioner -) : BubbleViewProvider { +class BubbleOverflow(private val context: Context, private val positioner: BubblePositioner) : + BubbleViewProvider { private lateinit var bitmap: Bitmap private lateinit var dotPath: Path @@ -54,7 +52,7 @@ class BubbleOverflow( overflowBtn = null } - /** Call before use and again if cleanUpExpandedState was called. */ + /** Call before use and again if cleanUpExpandedState was called. */ fun initialize(controller: BubbleController) { createExpandedView() getExpandedView()?.initialize(controller, controller.stackView, true /* isOverflow */) @@ -74,10 +72,10 @@ class BubbleOverflow( } fun updateResources() { - overflowIconInset = context.resources.getDimensionPixelSize( - R.dimen.bubble_overflow_icon_inset) - overflowBtn?.layoutParams = FrameLayout.LayoutParams(positioner.bubbleSize, - positioner.bubbleSize) + overflowIconInset = + context.resources.getDimensionPixelSize(R.dimen.bubble_overflow_icon_inset) + overflowBtn?.layoutParams = + FrameLayout.LayoutParams(positioner.bubbleSize, positioner.bubbleSize) expandedView?.updateDimensions() } @@ -85,36 +83,58 @@ class BubbleOverflow( val res = context.resources // Set overflow button accent color, dot color - val typedValue = TypedValue() - context.theme.resolveAttribute(com.android.internal.R.attr.colorAccentPrimary, - typedValue, true) - val colorAccent = res.getColor(typedValue.resourceId, null) - dotColor = colorAccent - val shapeColor = res.getColor(android.R.color.system_accent1_1000) + val typedArray = + context.obtainStyledAttributes( + intArrayOf( + com.android.internal.R.attr.materialColorPrimaryFixed, + com.android.internal.R.attr.materialColorOnPrimaryFixed + ) + ) + + val colorAccent = typedArray.getColor(0, Color.WHITE) + val shapeColor = typedArray.getColor(1, Color.BLACK) + typedArray.recycle() + + dotColor = colorAccent overflowBtn?.iconDrawable?.setTint(shapeColor) - val iconFactory = BubbleIconFactory(context, - context.getResources().getDimensionPixelSize(R.dimen.bubble_size), - context.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size), - context.getResources().getColor(R.color.important_conversation), - context.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.importance_ring_stroke_width)) + val iconFactory = + BubbleIconFactory( + context, + res.getDimensionPixelSize(R.dimen.bubble_size), + res.getDimensionPixelSize(R.dimen.bubble_badge_size), + res.getColor(R.color.important_conversation), + res.getDimensionPixelSize(com.android.internal.R.dimen.importance_ring_stroke_width) + ) // Update bitmap val fg = InsetDrawable(overflowBtn?.iconDrawable, overflowIconInset) - bitmap = iconFactory.createBadgedIconBitmap( - AdaptiveIconDrawable(ColorDrawable(colorAccent), fg)).icon + bitmap = + iconFactory + .createBadgedIconBitmap(AdaptiveIconDrawable(ColorDrawable(colorAccent), fg)) + .icon // Update dot path - dotPath = PathParser.createPathFromPathData( - res.getString(com.android.internal.R.string.config_icon_mask)) - val scale = iconFactory.normalizer.getScale(iconView!!.iconDrawable, - null /* outBounds */, null /* path */, null /* outMaskShape */) + dotPath = + PathParser.createPathFromPathData( + res.getString(com.android.internal.R.string.config_icon_mask) + ) + val scale = + iconFactory.normalizer.getScale( + iconView!!.iconDrawable, + null /* outBounds */, + null /* path */, + null /* outMaskShape */ + ) val radius = BadgedImageView.DEFAULT_PATH_SIZE / 2f val matrix = Matrix() - matrix.setScale(scale /* x scale */, scale /* y scale */, radius /* pivot x */, - radius /* pivot y */) + matrix.setScale( + scale /* x scale */, + scale /* y scale */, + radius /* pivot x */, + radius /* pivot y */ + ) dotPath.transform(matrix) // Attach BubbleOverflow to BadgedImageView @@ -132,8 +152,12 @@ class BubbleOverflow( } fun createExpandedView(): BubbleExpandedView? { - expandedView = inflater.inflate(R.layout.bubble_expanded_view, - null /* root */, false /* attachToRoot */) as BubbleExpandedView + expandedView = + inflater.inflate( + R.layout.bubble_expanded_view, + null /* root */, + false /* attachToRoot */ + ) as BubbleExpandedView expandedView?.applyThemeAttrs() updateResources() return expandedView @@ -177,11 +201,15 @@ class BubbleOverflow( override fun getIconView(): BadgedImageView? { if (overflowBtn == null) { - overflowBtn = inflater.inflate(R.layout.bubble_overflow_button, - null /* root */, false /* attachToRoot */) as BadgedImageView + overflowBtn = + inflater.inflate( + R.layout.bubble_overflow_button, + null /* root */, + false /* attachToRoot */ + ) as BadgedImageView overflowBtn?.initialize(positioner) - overflowBtn?.contentDescription = context.resources.getString( - R.string.bubble_overflow_button_content_description) + overflowBtn?.contentDescription = + context.resources.getString(R.string.bubble_overflow_button_content_description) val bubbleSize = positioner.bubbleSize overflowBtn?.layoutParams = FrameLayout.LayoutParams(bubbleSize, bubbleSize) updateBtnTheme() @@ -200,4 +228,4 @@ class BubbleOverflow( companion object { const val KEY = "Overflow" } -}
\ No newline at end of file +} diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowContainerView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowContainerView.java index 9aa285fff19c..9655470ce914 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowContainerView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflowContainerView.java @@ -220,8 +220,8 @@ public class BubbleOverflowContainerView extends LinearLayout { : res.getColor(R.color.bubbles_light)); final TypedArray typedArray = getContext().obtainStyledAttributes(new int[] { - android.R.attr.colorBackgroundFloating, - android.R.attr.textColorSecondary}); + com.android.internal.R.attr.materialColorSurfaceBright, + com.android.internal.R.attr.materialColorOnSurface}); int bgColor = typedArray.getColor(0, isNightMode ? Color.BLACK : Color.WHITE); int textColor = typedArray.getColor(1, isNightMode ? Color.WHITE : Color.BLACK); textColor = ContrastColorUtil.ensureTextContrast(textColor, bgColor, isNightMode); |