77 lines
2.7 KiB
C#
77 lines
2.7 KiB
C#
using System;
|
|
using Android.App;
|
|
using Android.Content.PM;
|
|
using Android.OS;
|
|
using Android.Views;
|
|
using Android.Widget;
|
|
using Bit.View;
|
|
using FFImageLoading.Forms.Platform;
|
|
using Plugin.CurrentActivity;
|
|
using Prism;
|
|
using Prism.Ioc;
|
|
using Rg.Plugins.Popup;
|
|
using Xamarin.Essentials;
|
|
using Xamarin.Forms;
|
|
using Color = Android.Graphics.Color;
|
|
|
|
namespace CafeTerrace.Droid
|
|
{
|
|
[Activity(WindowSoftInputMode = SoftInput.AdjustResize, Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
|
{
|
|
protected override void OnCreate(Bundle bundle)
|
|
{
|
|
try
|
|
{
|
|
TabLayoutResource = Resource.Layout.Tabbar;
|
|
ToolbarResource = Resource.Layout.Toolbar;
|
|
|
|
Forms.SetFlags("CarouselView_Experimental");
|
|
Forms.SetFlags("IndicatorView_Experimental");
|
|
base.OnCreate(bundle);
|
|
CachedImageRenderer.Init(true);
|
|
Forms.Init(this, bundle);
|
|
Platform.Init(this, bundle);
|
|
Window.AddFlags(WindowManagerFlags.TranslucentStatus);
|
|
Popup.Init(this, bundle);
|
|
CrossCurrentActivity.Current.Init(this, bundle);
|
|
BitCSharpClientControls.Init();
|
|
SetStatusBarColor(Color.Transparent);
|
|
//var window = ((Activity)Forms.Context).Window;
|
|
//window.SetSoftInputMode(SoftInput.AdjustPan);
|
|
LoadApplication(new App(new AndroidInitializer()));
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Toast.MakeText(Forms.Context, e.Message, ToastLength.Long);
|
|
}
|
|
}
|
|
|
|
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults)
|
|
{
|
|
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
|
|
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
}
|
|
public override void OnBackPressed()
|
|
{
|
|
if (Rg.Plugins.Popup.Popup.SendBackPressed(base.OnBackPressed))
|
|
{
|
|
// Do something if there are some pages in the `PopupStack`
|
|
}
|
|
else
|
|
{
|
|
// Do something if there are not any pages in the `PopupStack`
|
|
}
|
|
}
|
|
}
|
|
public class AndroidInitializer : IPlatformInitializer
|
|
{
|
|
public void RegisterTypes(IContainerRegistry containerRegistry)
|
|
{
|
|
// Register any platform specific implementations
|
|
}
|
|
}
|
|
}
|
|
|