using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Support.V7.App;

namespace Pixiview.Droid
{
    [Activity(
        MainLauncher = true,
        NoHistory = true,
        Theme = "@style/MainTheme.Splash",
        Name = "org.tsanie.pixiview.SplashScreen")]
    //[MetaData("android.app.shortcuts", Resource = "@xml/shortcuts")]
    public class SplashActivity : AppCompatActivity
    {
        public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
        {
            base.OnCreate(savedInstanceState, persistentState);

            //var intent = new Intent(this, typeof(MainActivity));
            //if (Intent != null && Intent.Data != null)
            //{
            //    intent.SetData(Intent.Data);
            //}
            //StartActivity(intent);
            //Finish();
        }

        protected override void OnResume()
        {
            base.OnResume();
            Task.Run(Start);
        }

        private void Start()
        {
            StartActivity(new Intent(Application.Context, typeof(MainActivity)));
        }

        public override void OnBackPressed() { }
    }
}
