xamarin-showcase-car-care/CarCare.Android/MainActivity.cs

37 строки
1.5 KiB
C#

using Android.App;
using Android.Content.PM;
using Android.OS;
using CarCare.Droid;
using Plugin.CurrentActivity;
using Plugin.Permissions;
using Xamarin.Forms;
[assembly: Dependency(typeof(ToastAndroid))]
namespace CarCare.Droid
{
[Activity(Label = "CarCare", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
internal static MainActivity Instance { get; private set; }
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Instance = this;
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
CrossCurrentActivity.Current.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Window.SetStatusBarColor(color: Android.Graphics.Color.ParseColor("#094b66"));
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}