1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-25 04:33:36 +00:00
Files
mobile/src/Android/SplashActivity.cs
Kyle Spearrin 3fe7324cdf more theming
2019-05-29 16:44:18 -04:00

54 lines
1.6 KiB
C#

using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.OS;
using Android.Support.V7.App;
using System.Threading.Tasks;
using Android.Content;
using Bit.App.Utilities;
namespace Bit.Droid
{
[Activity(
Label = "Bitwarden",
MainLauncher = true,
NoHistory = true,
Icon = "@mipmap/ic_launcher",
Theme = "@style/MainTheme.Splash",
WindowSoftInputMode = Android.Views.SoftInput.StateHidden,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[Register("com.x8bit.bitwarden.SplashActivity")]
public class SplashActivity : AppCompatActivity
{
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
UpdateTheme(ThemeManager.GetTheme());
base.OnCreate(savedInstanceState, persistentState);
}
protected override void OnResume()
{
base.OnResume();
var startupWork = new Task(() =>
{
var mainIntent = new Intent(Application.Context, typeof(MainActivity));
mainIntent.PutExtra("myVaultTile", Intent.GetBooleanExtra("myVaultTile", false));
StartActivity(mainIntent);
});
startupWork.Start();
}
private void UpdateTheme(string theme)
{
if(theme == "dark")
{
SetTheme(Resource.Style.DarkTheme_Splash);
}
else
{
SetTheme(Resource.Style.MainTheme_Splash);
}
}
}
}