lineage_patches_unified/patches_platform/frameworks_base/0024-SystemUI-Follow-light-dark-theme-in-power-menu.patch
2024-04-21 16:33:07 +08:00

87 lines
4.1 KiB
Diff

From 799c920e75780cf5146f3a3875ce3e84a6df32c1 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 8 Mar 2022 20:37:33 -0800
Subject: [PATCH 24/34] 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 e759c1211a93..e98196e800cf 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 91a72922fd0a..0e59b3b774df 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 d94c7bb1c0f8..661e4e6b4b95 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java
@@ -842,6 +842,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