sharee.bike-App/LastenradBayern/TINK.Android/MainActivity.cs

66 lines
2.5 KiB
C#
Raw Normal View History

2021-11-07 19:42:59 +01:00

using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Content;
using Java.Interop;
namespace TINK.Droid
{
2021-11-07 21:28:13 +01:00
[Activity (Label = "LastenradBayern", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
2021-11-07 19:42:59 +01:00
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate (Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
Xamarin.Essentials.Platform.Init(this, bundle);
// Required for initialization of Maps, see https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/
Xamarin.FormsGoogleMaps.Init(this, bundle);
// Required for initialization of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings.
Xamarin.FormsGoogleMapsBindings.Init();
// Get version name of app.
Context context = ApplicationContext;
new Model.Device.AppInfo(context.PackageManager.GetPackageInfo(context.PackageName, 0).VersionName);
Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => {
if (!string.IsNullOrWhiteSpace(e.View.AutomationId))
{
e.NativeView.ContentDescription = e.View.AutomationId;
}
};
LoadApplication(new App());
}
/// <summary>
/// Handles opening the dialog to request for permissions.
/// </summary>
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults)
{
if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Essentials.Permissions))
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
2021-11-15 11:15:43 +01:00
2021-11-07 19:42:59 +01:00
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
[Export("TapStation")]
public void TapStation(string stationNr)
{
BackdoorMethodHelpers.DoTapPage(stationNr);
}
}
}