diff --git a/projects/Demo/Demo.Android/MainActivity.cs b/projects/Demo/Demo.Android/MainActivity.cs index 6d5de839..555827f9 100644 --- a/projects/Demo/Demo.Android/MainActivity.cs +++ b/projects/Demo/Demo.Android/MainActivity.cs @@ -5,7 +5,7 @@ using LibVLCSharp.Forms.Shared; namespace Demo.Droid { - [Activity(Label = "Demo", Icon = "@mipmap/icon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + [Activity(Label = "Demo", Icon = "@mipmap/icon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, LaunchMode = LaunchMode.SingleTask)] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle savedInstanceState) @@ -25,5 +25,10 @@ namespace Demo.Droid { ZXing.Net.Mobile.Android.PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults); } + + public override void OnBackPressed() + { + this.MoveTaskToBack(true); + } } } \ No newline at end of file diff --git a/projects/Demo/Demo.Android/SplashActivity.cs b/projects/Demo/Demo.Android/SplashActivity.cs index 6e61df50..6b7fe787 100644 --- a/projects/Demo/Demo.Android/SplashActivity.cs +++ b/projects/Demo/Demo.Android/SplashActivity.cs @@ -2,7 +2,6 @@ using Android.Content; using Android.OS; using Android.Support.V7.App; -using Android.Util; using System.Threading.Tasks; namespace Demo.Droid @@ -10,15 +9,11 @@ namespace Demo.Droid [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] public class SplashActivity : AppCompatActivity { - private static readonly string TAG = "X:" + typeof(SplashActivity).Name; - public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState) { base.OnCreate(savedInstanceState, persistentState); - Log.Debug(TAG, "SplashActivity.OnCreate"); } - // Launches the startup task protected override void OnResume() { base.OnResume(); @@ -26,14 +21,10 @@ namespace Demo.Droid startupWork.Start(); } - // Simulates background work that happens behind the splash screen private async void SimulateStartup() { - Log.Debug(TAG, "Performing some startup work that takes a bit of time."); - await Task.Delay(8000); // Simulate a bit of startup work. - Log.Debug(TAG, "Startup work is finished - starting MainActivity."); + await Task.Delay(1); StartActivity(new Intent(Application.Context, typeof(MainActivity))); } - public override void OnBackPressed() { } } } \ No newline at end of file