Merge "Update colors for popup menus" into udc-dev am: 3eba77ca4b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23152777

Change-Id: If82e660ea5d01852d6109f11430a7fd16a381973
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/res/color-night-v31/popup_color_background.xml b/res/color-night-v31/popup_color_background.xml
new file mode 100644
index 0000000..13ceaa0
--- /dev/null
+++ b/res/color-night-v31/popup_color_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item
+        android:color="@android:color/system_neutral1_900"
+        android:lStar="12" />
+</selector>
diff --git a/res/color-v31/popup_color_background.xml b/res/color-v31/popup_color_background.xml
new file mode 100644
index 0000000..99155d8
--- /dev/null
+++ b/res/color-v31/popup_color_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item
+        android:color="@android:color/system_neutral1_50"
+        android:lStar="94" />
+</selector>
diff --git a/res/color/popup_color_background.xml b/res/color/popup_color_background.xml
new file mode 100644
index 0000000..e87e772
--- /dev/null
+++ b/res/color/popup_color_background.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:color="?attr/popupColorBackground" />
+</selector>
diff --git a/res/drawable/popup_background_material_u.xml b/res/drawable/popup_background_material_u.xml
index 4d40ba8..6eedecb 100644
--- a/res/drawable/popup_background_material_u.xml
+++ b/res/drawable/popup_background_material_u.xml
@@ -15,6 +15,6 @@
 -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="?attr/popupColorPrimary"/>
+    <solid android:color="?attr/popupColorBackground"/>
     <corners android:radius="@dimen/dialogCornerRadius"/>
 </shape>
\ No newline at end of file
diff --git a/res/layout/deep_shortcut_material_u.xml b/res/layout/deep_shortcut_material_u.xml
index fc019e9..2e21ddb 100644
--- a/res/layout/deep_shortcut_material_u.xml
+++ b/res/layout/deep_shortcut_material_u.xml
@@ -35,7 +35,7 @@
         android:singleLine="true"
         android:ellipsize="end"
         android:textSize="14sp"
-        android:textColor="?android:attr/textColorPrimary"
+        android:textColor="?attr/popupTextColor"
         launcher:layoutHorizontal="true"
         launcher:iconDisplay="shortcut_popup"
         launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size" />
diff --git a/res/layout/system_shortcut_content.xml b/res/layout/system_shortcut_content.xml
index 3008339..396a110 100644
--- a/res/layout/system_shortcut_content.xml
+++ b/res/layout/system_shortcut_content.xml
@@ -30,7 +30,7 @@
         android:lines="1"
         android:ellipsize="end"
         android:hyphenationFrequency="full"
-        android:textColor="@color/system_shortcut_text"
+        android:textColor="?attr/popupTextColor"
         launcher:iconDisplay="shortcut_popup"
         launcher:layoutHorizontal="true"
         android:focusable="false" />
@@ -41,5 +41,5 @@
         android:layout_height="@dimen/system_shortcut_icon_size"
         android:layout_marginStart="@dimen/system_shortcut_margin_start"
         android:layout_gravity="start|center_vertical"
-        android:backgroundTint="@color/system_shortcut_text"/>
+        android:backgroundTint="?attr/popupTextColor"/>
 </merge>
diff --git a/res/layout/system_shortcut_icon_only.xml b/res/layout/system_shortcut_icon_only.xml
index 92522aa..748696e 100644
--- a/res/layout/system_shortcut_icon_only.xml
+++ b/res/layout/system_shortcut_icon_only.xml
@@ -18,7 +18,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="@dimen/system_shortcut_header_icon_touch_size"
     android:layout_height="@dimen/system_shortcut_header_icon_touch_size"
-    android:tint="?attr/iconOnlyShortcutColor"
+    android:tint="?attr/popupTextColor"
     android:tintMode="src_in"
     android:padding="@dimen/system_shortcut_header_icon_padding"
     android:theme="@style/PopupItemIconOnly" />
diff --git a/res/layout/system_shortcut_icon_only_end.xml b/res/layout/system_shortcut_icon_only_end.xml
index b5b5f02..7059dd7 100644
--- a/res/layout/system_shortcut_icon_only_end.xml
+++ b/res/layout/system_shortcut_icon_only_end.xml
@@ -18,7 +18,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="@dimen/system_shortcut_header_icon_touch_size"
     android:layout_height="@dimen/system_shortcut_header_icon_touch_size"
-    android:tint="?attr/iconOnlyShortcutColor"
+    android:tint="?attr/popupTextColor"
     android:tintMode="src_in"
     android:padding="@dimen/system_shortcut_header_icon_padding"
     android:paddingStart="@dimen/system_shortcut_header_icon_padding_inner"
diff --git a/res/layout/system_shortcut_icon_only_start.xml b/res/layout/system_shortcut_icon_only_start.xml
index 33a6b17..ad9f55a 100644
--- a/res/layout/system_shortcut_icon_only_start.xml
+++ b/res/layout/system_shortcut_icon_only_start.xml
@@ -18,7 +18,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="@dimen/system_shortcut_header_icon_touch_size"
     android:layout_height="@dimen/system_shortcut_header_icon_touch_size"
-    android:tint="?attr/iconOnlyShortcutColor"
+    android:tint="?attr/popupTextColor"
     android:tintMode="src_in"
     android:padding="@dimen/system_shortcut_header_icon_padding"
     android:paddingStart="@dimen/system_shortcut_header_icon_padding_outer"
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index 9f09b99..2abaacb 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -20,10 +20,12 @@
     <color name="popup_color_primary_light">@android:color/system_accent2_50</color>
     <color name="popup_color_secondary_light">@android:color/system_neutral2_100</color>
     <color name="popup_color_tertiary_light">@android:color/system_neutral2_300</color>
+    <color name="popup_text_color_light">@android:color/system_neutral1_900</color>
     <color name="popup_color_neutral_dark">@android:color/system_neutral1_1000</color>
     <color name="popup_color_primary_dark">@android:color/system_neutral2_800</color>
     <color name="popup_color_secondary_dark">@android:color/system_neutral1_900</color>
     <color name="popup_color_tertiary_dark">@android:color/system_neutral2_700</color>
+    <color name="popup_text_color_dark">@android:color/system_neutral1_100</color>
 
     <color name="popup_notification_dot_light">@android:color/system_accent1_100</color>
     <color name="popup_notification_dot_dark">@android:color/system_accent2_600</color>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 0772557..7fdb94a 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -25,6 +25,8 @@
     <attr name="popupColorPrimary" format="color" />
     <attr name="popupColorSecondary" format="color" />
     <attr name="popupColorTertiary" format="color" />
+    <attr name="popupColorBackground" format="color" />
+    <attr name="popupTextColor" format="color" />
     <attr name="popupShadeFirst" format="color" />
     <attr name="popupShadeSecond" format="color" />
     <attr name="popupShadeThird" format="color" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 2295043..e639e99 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -39,10 +39,12 @@
     <color name="popup_color_primary_light">#FFF</color>
     <color name="popup_color_secondary_light">#F1F3F4</color>
     <color name="popup_color_tertiary_light">#E0E0E0</color> <!-- Gray 300 -->
+    <color name="popup_text_color_light">#1F1F1F</color>
     <color name="popup_color_neutral_dark">#3C4043</color> <!-- Gray 800 -->
     <color name="popup_color_primary_dark">#3C4043</color> <!-- Gray 800 -->
     <color name="popup_color_secondary_dark">#202124</color>
     <color name="popup_color_tertiary_dark">#757575</color> <!-- Gray 600 -->
+    <color name="popup_text_color_dark">#E3E3E3</color>
 
     <color name="popup_shade_first_light">#F9F9F9</color>
     <color name="popup_shade_second_light">#F1F1F1</color>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d0f2067..c803bec 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -37,6 +37,8 @@
         <item name="popupColorPrimary">@color/popup_color_primary_light</item>
         <item name="popupColorSecondary">@color/popup_color_secondary_light</item>
         <item name="popupColorTertiary">@color/popup_color_tertiary_light</item>
+        <item name="popupColorBackground">#EFEDED</item>
+        <item name="popupTextColor">@color/popup_text_color_light</item>
         <item name="popupShadeFirst">@color/popup_shade_first_light</item>
         <item name="popupShadeSecond">@color/popup_shade_second_light</item>
         <item name="popupShadeThird">@color/popup_shade_third_light</item>
@@ -105,6 +107,8 @@
         <item name="popupColorPrimary">@color/popup_color_primary_dark</item>
         <item name="popupColorSecondary">@color/popup_color_secondary_dark</item>
         <item name="popupColorTertiary">@color/popup_color_tertiary_dark</item>
+        <item name="popupColorBackground">#1F2020</item>
+        <item name="popupTextColor">@color/popup_text_color_dark</item>
         <item name="popupNotificationDotColor">@color/popup_notification_dot_dark</item>
         <item name="popupShadeFirst">@color/popup_shade_first_dark</item>
         <item name="popupShadeSecond">@color/popup_shade_second_dark</item>
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index b59b37a..72f99cb 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -144,7 +144,8 @@
 
         // Initialize arrow view
         final Resources resources = getResources();
-        mArrowColor = getColorStateList(getContext(), R.color.popup_shade_first).getDefaultColor();
+        mArrowColor = getColorStateList(getContext(), R.color.popup_color_background)
+                .getDefaultColor();
         mChildContainerMargin = resources.getDimensionPixelSize(R.dimen.popup_margin);
         mArrowWidth = resources.getDimensionPixelSize(R.dimen.popup_arrow_width);
         mArrowHeight = resources.getDimensionPixelSize(R.dimen.popup_arrow_height);
@@ -173,7 +174,7 @@
             mColorIds = new int[]{R.color.popup_shade_first, R.color.popup_shade_second,
                     R.color.popup_shade_third};
         } else {
-            mColorIds = new int[]{R.color.popup_shade_first};
+            mColorIds = new int[]{R.color.popup_color_background};
         }
     }