From 38af4f71c70ba26a045cd2052472d515f37b8b12 Mon Sep 17 00:00:00 2001 From: Jordan Silva Date: Tue, 11 Mar 2025 05:37:43 -0700 Subject: [PATCH] Add hover and pressed states for app chip and menu items Fix: 356830855 Flag: com.android.launcher3.enable_overview_icon_menu Test: OverviewActionsMenuHoverImageTest Change-Id: I3a244a4eea07192a622c57d28618dabbb107a088 --- .../res/color/app_chip_menu_item_color_fg.xml | 21 +++++++++++++++++++ .../res/color/app_chip_state_color_fg.xml | 20 ++++++++++++++++++ quickstep/res/drawable/app_chip_fg.xml | 18 ++++++++++++++++ .../res/drawable/app_chip_menu_item_bg.xml | 19 +++++++++++++++++ .../res/drawable/app_chip_menu_item_fg.xml | 20 ++++++++++++++++++ quickstep/res/layout/icon_app_chip_view.xml | 2 ++ .../android/quickstep/views/TaskMenuView.kt | 14 +++++++++++-- 7 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 quickstep/res/color/app_chip_menu_item_color_fg.xml create mode 100644 quickstep/res/color/app_chip_state_color_fg.xml create mode 100644 quickstep/res/drawable/app_chip_fg.xml create mode 100644 quickstep/res/drawable/app_chip_menu_item_bg.xml create mode 100644 quickstep/res/drawable/app_chip_menu_item_fg.xml diff --git a/quickstep/res/color/app_chip_menu_item_color_fg.xml b/quickstep/res/color/app_chip_menu_item_color_fg.xml new file mode 100644 index 0000000000..fa1dc34dce --- /dev/null +++ b/quickstep/res/color/app_chip_menu_item_color_fg.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/quickstep/res/color/app_chip_state_color_fg.xml b/quickstep/res/color/app_chip_state_color_fg.xml new file mode 100644 index 0000000000..58dfee0cf6 --- /dev/null +++ b/quickstep/res/color/app_chip_state_color_fg.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/quickstep/res/drawable/app_chip_fg.xml b/quickstep/res/drawable/app_chip_fg.xml new file mode 100644 index 0000000000..7b19c9e134 --- /dev/null +++ b/quickstep/res/drawable/app_chip_fg.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/quickstep/res/drawable/app_chip_menu_item_bg.xml b/quickstep/res/drawable/app_chip_menu_item_bg.xml new file mode 100644 index 0000000000..39e88d2eed --- /dev/null +++ b/quickstep/res/drawable/app_chip_menu_item_bg.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/quickstep/res/drawable/app_chip_menu_item_fg.xml b/quickstep/res/drawable/app_chip_menu_item_fg.xml new file mode 100644 index 0000000000..96d067d5b8 --- /dev/null +++ b/quickstep/res/drawable/app_chip_menu_item_fg.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/quickstep/res/layout/icon_app_chip_view.xml b/quickstep/res/layout/icon_app_chip_view.xml index 0972be16e3..de05d591fc 100644 --- a/quickstep/res/layout/icon_app_chip_view.xml +++ b/quickstep/res/layout/icon_app_chip_view.xml @@ -26,6 +26,7 @@ android:importantForAccessibility="no" android:autoMirrored="true" android:elevation="@dimen/task_thumbnail_icon_menu_elevation" + android:foreground="@drawable/app_chip_fg" android:background="@color/materialColorSurfaceBright"> @@ -77,4 +78,5 @@ android:background="@drawable/icon_menu_arrow_background" android:src="@drawable/ic_chevron_down" android:importantForAccessibility="no" /> + \ No newline at end of file diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.kt b/quickstep/src/com/android/quickstep/views/TaskMenuView.kt index 7c762f4bea..95ff46bfca 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuView.kt +++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.kt @@ -22,7 +22,6 @@ import android.animation.ValueAnimator import android.content.Context import android.graphics.Outline import android.graphics.Rect -import android.graphics.drawable.GradientDrawable import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.RectShape import android.util.AttributeSet @@ -165,7 +164,18 @@ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int = 0) : recentsViewContainer.layoutInflater.inflate(R.layout.task_view_menu_option, this, false) as LinearLayout if (enableOverviewIconMenu()) { - (menuOptionView.background as GradientDrawable).cornerRadius = 0f + menuOptionView.background = + ResourcesCompat.getDrawable( + resources, + R.drawable.app_chip_menu_item_bg, + context.theme, + ) + menuOptionView.foreground = + ResourcesCompat.getDrawable( + resources, + R.drawable.app_chip_menu_item_fg, + context.theme, + ) } menuOption.setIconAndLabelFor( menuOptionView.findViewById(R.id.icon),