diff --git a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/App.xaml.cs b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/App.xaml.cs index 0b14e8e..2e885b0 100644 --- a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/App.xaml.cs +++ b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/App.xaml.cs @@ -1,4 +1,6 @@ +using System; using Microsoft.Maui.ApplicationModel; +using Microsoft.Maui.Graphics; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; using Xamarin.Neo4j.Pages; @@ -10,15 +12,23 @@ namespace Xamarin.Neo4j { public partial class App : Application { + public static event EventHandler ThemeChanged; + public App() { InitializeComponent(); SetTheme(Current.RequestedTheme); + RequestedThemeChanged += (s, e) => SetTheme(e.RequestedTheme); - MainPage = new NavigationPage(new RootPage()); + MainPage = new NavigationPage(new ConnectionsPage()); + + // SetTheme ran before MainPage was assigned, so apply bar colours now. + ApplyNavBarColors(); } + public void UpdateTheme(AppTheme theme) => SetTheme(theme); + private void SetTheme(AppTheme theme) { Resources = theme switch @@ -28,6 +38,20 @@ namespace Xamarin.Neo4j _ => new LightTheme() }; + + ApplyNavBarColors(); + ThemeChanged?.Invoke(this, EventArgs.Empty); + } + + // Called both from SetTheme and from MainActivity.OnResume so that + // theme changes while the app is backgrounded are picked up on return. + public void ApplyNavBarColors() + { + if (MainPage is NavigationPage navPage) + { + navPage.BarBackgroundColor = Color.FromArgb("#31333b"); + navPage.BarTextColor = Colors.White; + } } protected override void OnStart() diff --git a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/DarkTheme.xaml b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/DarkTheme.xaml index f7a7e94..7dfe301 100644 --- a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/DarkTheme.xaml +++ b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/DarkTheme.xaml @@ -31,7 +31,7 @@ diff --git a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/Fonts.xaml b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/Fonts.xaml index 4edef7b..d88e43e 100644 --- a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/Fonts.xaml +++ b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/Fonts.xaml @@ -4,18 +4,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Neo4j.Themes.Fonts"> - - - - + FontAwesome5Brands-Regular + FontAwesome5Free-Solid + FontAwesome5Free-Regular - - - - - - - - - diff --git a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/LightTheme.xaml b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/LightTheme.xaml index 0b1e6b4..64e49af 100644 --- a/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/LightTheme.xaml +++ b/Xamarin.Neo4j/Xamarin.Neo4j/Xamarin.Neo4j/Themes/LightTheme.xaml @@ -23,6 +23,15 @@ + + + +