From 37daceca612285f24b7d5f161d1308ab838351e0 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sat, 8 Jul 2023 00:06:11 +0800 Subject: [PATCH] feat: fix android start activity issue. --- .../MainActivity.cs | 6 ++--- .../SplashActivity.cs | 22 ------------------- 2 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 demo/Semi.Avalonia.Demo.Android/SplashActivity.cs diff --git a/demo/Semi.Avalonia.Demo.Android/MainActivity.cs b/demo/Semi.Avalonia.Demo.Android/MainActivity.cs index 7906c4f..d037305 100644 --- a/demo/Semi.Avalonia.Demo.Android/MainActivity.cs +++ b/demo/Semi.Avalonia.Demo.Android/MainActivity.cs @@ -4,9 +4,9 @@ using Avalonia.Android; namespace Semi.Avalonia.Demo.Android; -[Activity(Label = "Semi.Avalonia.Demo.Android", Icon = "@drawable/Icon", Theme = "@style/MyTheme.NoActionBar", - LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] -public class MainActivity : AvaloniaMainActivity +[Activity(Label = "Semi.Avalonia.Demo.Android", Icon = "@drawable/Icon", MainLauncher = true, Theme = "@style/MyTheme.NoActionBar", + LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] +public class MainActivity : AvaloniaMainActivity { } \ No newline at end of file diff --git a/demo/Semi.Avalonia.Demo.Android/SplashActivity.cs b/demo/Semi.Avalonia.Demo.Android/SplashActivity.cs deleted file mode 100644 index 3186324..0000000 --- a/demo/Semi.Avalonia.Demo.Android/SplashActivity.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Android.App; -using Android.Content; -using Avalonia; -using Avalonia.Android; -using Application = Android.App.Application; - -namespace Semi.Avalonia.Demo.Android; - -[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] -public class SplashActivity: AvaloniaMainActivity -{ - protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) - { - return base.CustomizeAppBuilder(builder); - } - - protected override void OnResume() - { - base.OnResume(); - StartActivity(new Intent(Application.Context, typeof(MainActivity))); - } -} \ No newline at end of file