Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
UEngage/UEngage.Android/SplashActivity.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
47 lines (42 sloc)
1.49 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Android.App; | |
using Android.Content; | |
using Android.OS; | |
using Android.Runtime; | |
using Android.Support.V7.App; | |
using Android.Util; | |
using Android.Views; | |
using Android.Widget; | |
namespace UEngage.Droid | |
{ | |
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] | |
public class SplashActivity : AppCompatActivity | |
{ | |
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(); | |
Task startupWork = new Task(() => { SimulateStartup(); }); | |
startupWork.Start(); | |
} | |
// Simulates background work that happens behind the splash screen | |
async void SimulateStartup() | |
{ | |
Log.Debug(TAG, "Performing some startup work that takes a bit of time."); | |
await Task.Delay(3000); // Simulate a bit of startup work. | |
Log.Debug(TAG, "Startup work is finished - starting MainActivity."); | |
StartActivity(new Intent(Application.Context, typeof(MainActivity))); | |
} | |
public override void OnBackPressed() { } | |
} | |
} |