From 8814d5f322e5d1eb47c3e6d817d6206ff86528cf Mon Sep 17 00:00:00 2001 From: angelinn Date: Sat, 11 May 2024 19:04:31 +0300 Subject: [PATCH] Fix theme specific colors. --- .../TramlineFive.Common/ViewModels/SettingsViewModel.cs | 8 +++++++- .../Converters/TransportTypeToColorConverter.cs | 2 +- .../Platforms/Android/AndroidManifest.xml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TramlineFive/TramlineFive.Common/ViewModels/SettingsViewModel.cs b/src/TramlineFive/TramlineFive.Common/ViewModels/SettingsViewModel.cs index bfa80f1..3247546 100644 --- a/src/TramlineFive/TramlineFive.Common/ViewModels/SettingsViewModel.cs +++ b/src/TramlineFive/TramlineFive.Common/ViewModels/SettingsViewModel.cs @@ -50,7 +50,13 @@ public SettingsViewModel(VersionService versionService) SelectedFetchingStrategy = ApplicationService.GetStringSetting(Settings.FetchingStrategy, "Full"); string theme = ApplicationService.GetStringSetting(Settings.Theme, Names.SystemDefault); - SelectedTheme = theme == Names.LightTheme ? Themes[0] : Themes[1]; + SelectedTheme = theme switch + { + Names.LightTheme => Themes[0], + Names.DarkTheme => Themes[1], + Names.SystemDefault => Themes[2], + _ => Themes[2] + }; } public void Initialize(Func> displayActionSheet) diff --git a/src/TramlineFive/TramlineFive.Maui/Converters/TransportTypeToColorConverter.cs b/src/TramlineFive/TramlineFive.Maui/Converters/TransportTypeToColorConverter.cs index 51b0359..21c2fdc 100644 --- a/src/TramlineFive/TramlineFive.Maui/Converters/TransportTypeToColorConverter.cs +++ b/src/TramlineFive/TramlineFive.Maui/Converters/TransportTypeToColorConverter.cs @@ -12,7 +12,7 @@ public class TransportTypeToColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - bool isLightTheme = Application.Current.UserAppTheme == AppTheme.Light; + bool isLightTheme = Application.Current.RequestedTheme == AppTheme.Light; string textValue = string.Empty; if (value is TransportType type) diff --git a/src/TramlineFive/TramlineFive.Maui/Platforms/Android/AndroidManifest.xml b/src/TramlineFive/TramlineFive.Maui/Platforms/Android/AndroidManifest.xml index 86226c1..404aa88 100644 --- a/src/TramlineFive/TramlineFive.Maui/Platforms/Android/AndroidManifest.xml +++ b/src/TramlineFive/TramlineFive.Maui/Platforms/Android/AndroidManifest.xml @@ -1,5 +1,5 @@  - +