Themes: use separate themes for DayNight/OLED/DynamicColors.

Fixes #2123.
This commit is contained in:
Dennis Guse
2025-07-01 20:40:03 +02:00
parent edac784b1e
commit c34e9bd7b6
10 changed files with 124 additions and 120 deletions
+24 -12
View File
@@ -270,8 +270,7 @@
<!-- User Interface Settings -->
<string name="settings_ui_dynamic_colors_key" translatable="false">uiDynamicColors</string>
<bool name="settings_ui_dynamic_colors_default" translatable="false">false</bool>
<string name="deleted20250703" translatable="false">uiDynamicColors</string> <!-- DELETED -->
<!-- Recording Settings -->
<string name="stats_show_on_lockscreen_while_recording_key" translatable="false">trackdetail_show_on_lockscreen_while_recording</string>
@@ -301,23 +300,36 @@
<string name="locale_key" translatable="false">localeKey</string>
<!-- androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode() -->
<string name="night_mode_key" translatable="false">nightMode</string>
<string name="night_mode_default" translatable="false">@string/night_mode_system_value</string>
<string name="night_mode_no_value" translatable="false">1</string>
<string name="night_mode_yes_value" translatable="false">2</string>
<string name="night_mode_night_oled_value" translatable="false">3</string>
<string name="night_mode_system_value" translatable="false">-1</string>
<string name="theme_key" translatable="false">nightMode</string>
<string name="theme_default" translatable="false">@string/theme_daynight_value</string>
<string name="theme_daynight_value" translatable="false">0</string>
<string name="theme_daynight_dynamic_value" translatable="false">1</string>
<string name="theme_day_value" translatable="false">2</string>
<string name="theme_day_dynamic_value" translatable="false">3</string>
<string name="theme_night_value" translatable="false">4</string>
<string name="theme_night_dynamic_value" translatable="false">5</string>
<string name="theme_oled_value" translatable="false">6</string>
<string name="theme_oled_dynamic_value" translatable="false">7</string>
<string-array name="night_mode_values">
<item>@string/night_mode_system_value</item>
<item>@string/night_mode_no_value</item>
<item>@string/night_mode_yes_value</item>
<item>@string/night_mode_night_oled_value</item>
<item>@string/theme_daynight_value</item>
<item>@string/theme_daynight_dynamic_value</item>
<item>@string/theme_day_value</item>
<item>@string/theme_day_dynamic_value</item>
<item>@string/theme_night_value</item>
<item>@string/theme_night_dynamic_value</item>
<item>@string/theme_oled_value</item>
<item>@string/theme_oled_dynamic_value</item>
</string-array>
<string-array name="night_mode_options">
<!-- TODO: rename night_mode to theme and night_oled to oled -->
<item>@string/settings_night_mode_option_system</item>
<item>@string/settings_night_mode_option_system_dynamic</item>
<item>@string/settings_night_mode_option_day</item>
<item>@string/settings_night_mode_option_day_dynamic</item>
<item>@string/settings_night_mode_option_night</item>
<item>@string/settings_night_mode_option_night_dynamic</item>
<item>@string/settings_night_mode_option_night_oled</item>
<item>@string/settings_night_mode_option_night_oled_dynamic</item>
</string-array>
<!-- Stats layout customization -->
+5 -1
View File
@@ -380,9 +380,13 @@ limitations under the License.
<string name="settings_locale_system_default">System default</string>
<string name="settings_night_mode_title">UI Theme</string>
<string name="settings_night_mode_option_system">System</string>
<string name="settings_night_mode_option_system_dynamic">System (DynamicColor)</string>
<string name="settings_night_mode_option_day">Day</string>
<string name="settings_night_mode_option_day_dynamic">Day (DynamicColor)</string>
<string name="settings_night_mode_option_night">Night</string>
<string name="settings_night_mode_option_night_oled">Night (OLED friendly)</string>
<string name="settings_night_mode_option_night_dynamic">Night (DynamicColor)</string>
<string name="settings_night_mode_option_night_oled">OLED friendly</string>
<string name="settings_night_mode_option_night_oled_dynamic">OLED friendly (DynamicColor)</string>
<string name="settings_announcements_totaltime_frequency">Time interval</string>
<string name="settings_announcements_distance_frequency">Lap length</string>
<string name="settings_announcements_average_heart_rate">Average heart rate</string>
+35 -20
View File
@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="OpenTracksTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/opentracks</item>
<item name="colorSecondary">@color/opentracks</item>
<style name="DayNightDynamicTheme" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Material3 https://github.com/material-components/material-components-android/issues/2828#issuecomment-1187563903 -->
<item name="switchPreferenceCompatStyle">@style/MaterialSwitchPreferenceCompat</item>
@@ -26,19 +23,12 @@
<item name="actionBarSize">88dp</item>
</style>
<style name="SplashTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_logo_color_108dp</item>
<item name="postSplashScreenTheme">@style/OpenTracksTheme</item>
</style>
<style name="Widget.OpenTracks.BottomAppBar" parent="Widget.Material3.BottomAppBar">
<item name="backgroundTint">?attr/colorSurfaceContainer</item>
</style>
<style name="OpenTracksThemeOled" parent="Theme.Material3.Dark.NoActionBar">
<style name="DayNightColorTheme" parent="DayNightDynamicTheme">
<item name="colorPrimary">@color/opentracks</item>
<item name="colorSecondary">@color/opentracks</item>
</style>
<style name="NightOledDynamicTheme" parent="Theme.Material3.Dark.NoActionBar">
<!-- Material3 https://github.com/material-components/material-components-android/issues/2828#issuecomment-1187563903 -->
<item name="switchPreferenceCompatStyle">@style/MaterialSwitchPreferenceCompat</item>
@@ -54,16 +44,41 @@
<!-- Differences to OpenTracksTheme -->
<item name="bottomAppBarStyle">@style/Widget.OpenTracks.BottomAppBarOled</item>
<item name="android:statusBarColor">@android:color/black</item>
<item name="android:statusBarColor">@color/oled_friendly</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:navigationBarColor">@android:color/black</item>
<item name="android:navigationBarColor">@color/oled_friendly</item>
<item name="colorSurface">@android:color/black</item>
<item name="colorSurfaceContainer">@android:color/black</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="colorSurface">@color/oled_friendly</item>
<item name="colorSurfaceContainer">@color/oled_friendly</item>
<item name="colorSurfaceDim">@color/oled_friendly</item>
<item name="backgroundColor">@color/oled_friendly</item>
<item name="android:windowBackground">@color/oled_friendly</item>
<!-- Material3-related: otherwise the actionbar does not overlay the SearchBar completely (with AppBarLayout) -->
<item name="actionBarSize">88dp</item>
</style>
<style name="NightOledColorTheme" parent="NightOledDynamicTheme">
<item name="colorPrimary">@color/opentracks</item>
<item name="colorSecondary">@color/opentracks</item>
</style>
<style name="Widget.OpenTracks.BottomAppBarOled" parent="Widget.Material3.BottomAppBar">
<item name="backgroundTint">@android:color/transparent</item>
<item name="backgroundTint">@color/oled_friendly</item>
</style>
<style name="SplashTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_logo_color_108dp</item>
<item name="postSplashScreenTheme">@style/DayNightColorTheme</item>
</style>
<style name="Widget.OpenTracks.BottomAppBar" parent="Widget.Material3.BottomAppBar">
<item name="materialThemeOverlay">@style/ThemeOverlay.OpenTracks.BottomAppBar</item>
</style>
<style name="ThemeOverlay.OpenTracks.BottomAppBar" parent="">
<item name="colorPrimary">@color/oled_friendly</item>
</style>
</resources>