theme: night-aware launch background kills white flash (#734)
- Commit
4e4eac1e40129da30c4a71daf5723d0fd35787f2- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-20 01:12 UTC (2 months ago)
- Parents
f4222a2
Diff
library/src/main/res/values-night/launch_colors.xml
diff --git a/library/src/main/res/values-night/launch_colors.xml b/library/src/main/res/values-night/launch_colors.xmlnew file mode 100644index 0000000000..e89c7ebbd0--- /dev/null+++ b/library/src/main/res/values-night/launch_colors.xml@@ -0,0 +1,6 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <!-- Pre-first-frame window background, dark side of the Theme.General fix: pitch black,+ matching DynamicTheme's dark surface, so cold starts no longer flash white. -->+ <color name="launch_window_background">#000000</color>+</resources>
library/src/main/res/values/launch_colors.xml
diff --git a/library/src/main/res/values/launch_colors.xml b/library/src/main/res/values/launch_colors.xmlnew file mode 100644index 0000000000..05eed0e45f--- /dev/null+++ b/library/src/main/res/values/launch_colors.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <!-- Pre-first-frame window background, light side of the Theme.General fix. -->+ <color name="launch_window_background">#FFFFFF</color>+</resources>
library/src/main/res/values/themes.xml
diff --git a/library/src/main/res/values/themes.xml b/library/src/main/res/values/themes.xmlindex 068c721cf1..97f7b6d94f 100644--- a/library/src/main/res/values/themes.xml+++ b/library/src/main/res/values/themes.xml@@ -1,7 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <resources> + <!-- Pre-first-frame window. The parent was hardcoded Light, so every cold start flashed+ white in dark mode. The background matches the system night state instead: black+ while dark, white while light, before DynamicTheme paints the first frame. --> <style name="Theme.General" parent="android:Theme.Material.Light.NoActionBar"> <item name="android:windowSoftInputMode">stateUnchanged</item>+ <item name="android:windowBackground">@color/launch_window_background</item> </style> </resources>\ No newline at end of file