87 lines
4.1 KiB
Diff
87 lines
4.1 KiB
Diff
From a4b814c2e24e9a5c3bb9d1f50393b207216df6ac Mon Sep 17 00:00:00 2001
|
|
From: Danny Lin <danny@kdrag0n.dev>
|
|
Date: Tue, 8 Mar 2022 20:37:33 -0800
|
|
Subject: [PATCH 21/31] SystemUI: Follow light/dark theme in power menu
|
|
|
|
Now that we've modified the power menu to refresh on UI mode changes,
|
|
make it follow the system light/dark theme for better integration in
|
|
light mode.
|
|
|
|
SystemUI: Always refresh power menu on UI mode change
|
|
|
|
This is necessary for reliably theming the global actions dialog with
|
|
dynamic colors and adapting it to light/dark themes.
|
|
|
|
Demo screenshots (with color overlays applied):
|
|
https://twitter.com/kdrag0n/status/1445960685427433473
|
|
|
|
[kdrag0n: ported to 12L]
|
|
|
|
Change-Id: If58fb4079a4cd11414ff928fad3576beecb14ff5
|
|
Signed-off-by: althafvly <althafvly@gmail.com>
|
|
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
|
|
---
|
|
packages/SystemUI/res/values-night/colors.xml | 5 +++++
|
|
packages/SystemUI/res/values/colors.xml | 8 ++++----
|
|
.../systemui/globalactions/GlobalActionsDialogLite.java | 9 +++++++++
|
|
3 files changed, 18 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml
|
|
index 99311e3d1e1b..6e61294327f7 100644
|
|
--- a/packages/SystemUI/res/values-night/colors.xml
|
|
+++ b/packages/SystemUI/res/values-night/colors.xml
|
|
@@ -55,6 +55,11 @@
|
|
<!-- The color of the text in the Global Actions menu -->
|
|
<color name="global_actions_text">@color/GM2_grey_200</color>
|
|
|
|
+ <!-- Colors for Power Menu Lite -->
|
|
+ <color name="global_actions_lite_background">@*android:color/primary_device_default_dark</color>
|
|
+ <color name="global_actions_lite_button_background">@*android:color/surface_dark</color>
|
|
+ <color name="global_actions_lite_text">@*android:color/foreground_device_default_dark</color>
|
|
+
|
|
<!-- The color of the text in the Global Actions menu -->
|
|
<color name="global_actions_alert_text">@color/GM2_red_300</color>
|
|
|
|
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
|
|
index fed2f9172dc3..b494973b319f 100644
|
|
--- a/packages/SystemUI/res/values/colors.xml
|
|
+++ b/packages/SystemUI/res/values/colors.xml
|
|
@@ -36,10 +36,10 @@
|
|
<color name="global_actions_grid_background">#F1F3F4</color>
|
|
|
|
<!-- Colors for Power Menu Lite -->
|
|
- <color name="global_actions_lite_background">#191C18</color>
|
|
- <color name="global_actions_lite_button_background">#303030</color>
|
|
- <color name="global_actions_lite_button_background_focused">#666666</color>
|
|
- <color name="global_actions_lite_text">#F0F0F0</color>
|
|
+ <color name="global_actions_lite_background">@*android:color/primary_device_default_light</color>
|
|
+ <color name="global_actions_lite_button_background">@*android:color/surface_light</color>
|
|
+ <color name="global_actions_lite_button_background_focused">#666666</color> <!-- LOS TV-specific, don't care -->
|
|
+ <color name="global_actions_lite_text">@*android:color/foreground_device_default_light</color>
|
|
<color name="global_actions_lite_emergency_background">#F85D4D</color>
|
|
<color name="global_actions_lite_emergency_icon">@color/GM2_grey_900</color>
|
|
|
|
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
|
|
index cb8e7c4ca073..3ec6a7cde410 100644
|
|
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
|
|
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
|
|
@@ -831,6 +831,15 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
|
user.id) != 0;
|
|
}
|
|
|
|
+ @Override
|
|
+ public void onUiModeChanged() {
|
|
+ // Colors may change, depending on UI mode
|
|
+ mContext.getTheme().applyStyle(mContext.getThemeResId(), true);
|
|
+ if (mDialog != null && mDialog.isShowing()) {
|
|
+ mDialog.refreshDialog();
|
|
+ }
|
|
+ }
|
|
+
|
|
@Override
|
|
public void onConfigChanged(Configuration newConfig) {
|
|
if (mDialog != null && mDialog.isShowing()
|
|
--
|
|
2.34.1
|
|
|