From 4bb5dc2fa58eda4aa1eb6c07c4a62a1ae37d7d28 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 22 Sep 2026 23:57:04 +0000 Subject: [PATCH 1/2] fix(android): follow system theme so WebView sees correct prefers-color-scheme With Theme.AppCompat.Light.NoActionBar the Activity always ran in light mode, so Android WebView reported prefers-color-scheme: light even when the OS was in dark mode. Choosing 'System' in aw-webui's theme setting therefore always resolved to light. Fix: - Add AWApplication that calls AppCompatDelegate.setDefaultNightMode( MODE_NIGHT_FOLLOW_SYSTEM) before any Activity starts. This wires the Activity's effective night mode to the OS setting without triggering any Activity recreation (the mode is set at process start, not at runtime). - Change AppTheme parent to Theme.AppCompat.DayNight.NoActionBar so the theme properly responds to the night mode configuration. - Add default_text_color night override so the existing android:textColor override doesn't produce black text on dark backgrounds. Closes #300 Git-Session-Id: dc18 --- mobile/src/main/AndroidManifest.xml | 1 + .../activitywatch/android/AWApplication.kt | 16 +++++++++++++ mobile/src/main/res/values-night/colors.xml | 3 +++ mobile/src/main/res/values/styles.xml | 7 ++++-- .../android/AWApplicationTest.kt | 23 +++++++++++++++++++ 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 mobile/src/main/java/net/activitywatch/android/AWApplication.kt create mode 100644 mobile/src/test/java/net/activitywatch/android/AWApplicationTest.kt diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index 4e90ab11..4d8c24bd 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -21,6 +21,7 @@ + + #FFFFFF + #2A2A2A #FFFFFF diff --git a/mobile/src/main/res/values/styles.xml b/mobile/src/main/res/values/styles.xml index 3c10b77e..7e4c15da 100644 --- a/mobile/src/main/res/values/styles.xml +++ b/mobile/src/main/res/values/styles.xml @@ -1,7 +1,10 @@ - -