mirror of
https://github.com/awatertrevi/xamarin-neo4j.git
synced 2026-09-22 09:05:29 +00:00
- Set colorPrimary/colorPrimaryDark/colorAccent to dark app colors (#31333b) - Fix contextual action bar (CAB) background to match nav bar color - Fix overflow button (3-dot) tint to white via OverflowMenuButton style - Fix white-on-white popup menu text: remove global android:textColorPrimary override; scope white text only to CAB via ActionModeStyle/ActionModeTitleText - Add android:windowLightStatusBar=false so status bar icons are white on dark bg Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using Android.App;
|
|
using Android.Content.PM;
|
|
using Android.Content.Res;
|
|
using Microsoft.Maui;
|
|
using Microsoft.Maui.ApplicationModel;
|
|
|
|
namespace Xamarin.Neo4j.Android
|
|
{
|
|
[Activity(
|
|
Theme = "@style/Maui.SplashTheme",
|
|
MainLauncher = true,
|
|
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation |
|
|
ConfigChanges.UiMode | ConfigChanges.ScreenLayout |
|
|
ConfigChanges.SmallestScreenSize | ConfigChanges.Density
|
|
)]
|
|
public class MainActivity : MauiAppCompatActivity
|
|
{
|
|
protected override void OnResume()
|
|
{
|
|
base.OnResume();
|
|
|
|
// Re-apply theme and nav bar colours when returning to the foreground.
|
|
// ConfigChanges.UiMode prevents Activity recreation on system theme change,
|
|
// so RequestedThemeChanged may not fire reliably — we re-derive the theme
|
|
// from the current configuration instead.
|
|
if (IPlatformApplication.Current?.Application is App app)
|
|
{
|
|
var nightMode = Resources.Configuration.UiMode & UiMode.NightMask;
|
|
var theme = nightMode == UiMode.NightYes
|
|
? AppTheme.Dark
|
|
: AppTheme.Light;
|
|
|
|
MainThread.BeginInvokeOnMainThread(() => app.UpdateTheme(theme));
|
|
}
|
|
}
|
|
}
|
|
}
|