MainActivity.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. using Android.App;
  2. using Android.Content.PM;
  3. using Avalonia;
  4. using Avalonia.Android;
  5. using Avalonia.ReactiveUI;
  6. using Splat;
  7. using VeloeAvaloniaKemonoPartyApp.Android.Services;
  8. using VeloeAvaloniaKemonoPartyApp.Services;
  9. namespace VeloeAvaloniaKemonoPartyApp.Android
  10. {
  11. [Activity(
  12. Label = "VeloeKemonoParty",
  13. Theme = "@style/MyTheme.NoActionBar",
  14. Icon = "@drawable/icon",
  15. MainLauncher = true,
  16. ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
  17. public class MainActivity : AvaloniaMainActivity<App>
  18. {
  19. protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
  20. {
  21. Locator.CurrentMutable.RegisterLazySingleton<IOpenUrlService>(() => new AndroidOpenUrlService());
  22. Locator.CurrentMutable.RegisterLazySingleton<IStorageService>(() => new AndroidStorageService(CacheDir.AbsolutePath));
  23. return base.CustomizeAppBuilder(builder)
  24. .WithInterFont()
  25. .UseSkia().With(new SkiaOptions() { MaxGpuResourceSizeBytes = 512 * 1024 * 1024 })
  26. .With(new AndroidPlatformOptions() { RenderingMode = new[] { AndroidRenderingMode.Egl } })
  27. .UseReactiveUI();
  28. }
  29. }
  30. }