MainActivity.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. using Android.App;
  2. using Android.Content.PM;
  3. using Android.OS;
  4. using Avalonia.Android;
  5. using static Android.Content.Intent;
  6. // leanback and touchscreen are required for the Android TV.
  7. [assembly: UsesFeature("android.software.leanback", Required = false)]
  8. [assembly: UsesFeature("android.hardware.touchscreen", Required = false)]
  9. namespace ControlCatalog.Android
  10. {
  11. [Activity(Name = "com.Avalonia.ControlCatalog.MainActivity", Label = "ControlCatalog.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", MainLauncher = true, Exported = true, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
  12. // CategoryLeanbackLauncher is required for Android TV.
  13. [IntentFilter(new[] { ActionView }, Categories = new[] { CategoryDefault, CategoryLeanbackLauncher })]
  14. public class MainActivity : AvaloniaMainActivity
  15. {
  16. }
  17. /// <summary>
  18. /// Special activity to handle OpenUri activation.
  19. /// `AvaloniaActivity` internally will redirect parameters to the Avalonia Application.
  20. /// </summary>
  21. [Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop, Exported = true, Theme = "@android:style/Theme.NoDisplay")]
  22. [IntentFilter(new[] { ActionView }, Categories = new[] { CategoryDefault, CategoryBrowsable }, DataScheme = "avln")]
  23. public class DataSchemeActivity : AvaloniaActivity
  24. {
  25. protected override void OnCreate(Bundle? savedInstanceState)
  26. {
  27. base.OnCreate(savedInstanceState);
  28. Finish();
  29. }
  30. }
  31. }