feature: Android splash screen
This commit is contained in:
parent
d32c5eb69a
commit
a4caf325b0
@ -5,7 +5,7 @@ using Android.Runtime;
|
||||
|
||||
namespace Pixiview.Droid
|
||||
{
|
||||
[Activity(Label = "Pixiview", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
[Activity(Label = "Pixiview", Icon = "@mipmap/icon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
public static MainActivity Main { get; private set; }
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.513" package="org.tsanie.pixiview" android:versionCode="3">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.514" package="org.tsanie.pixiview" android:versionCode="4">
|
||||
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="29" />
|
||||
<application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
969
Pixiview.Android/Resources/Resource.designer.cs
generated
969
Pixiview.Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
BIN
Pixiview.Android/Resources/drawable/splash_logo.png
Normal file
BIN
Pixiview.Android/Resources/drawable/splash_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
12
Pixiview.Android/Resources/drawable/splash_screen.xml
Normal file
12
Pixiview.Android/Resources/drawable/splash_screen.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<color android:color="@color/splash_background"/>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/splash_logo"
|
||||
android:tileMode="disabled"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
</layer-list>
|
@ -6,4 +6,5 @@
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="normal">@android:color/transparent</color>
|
||||
<color name="selected">#007AFF</color>
|
||||
<color name="splash_background">?android:attr/colorBackground</color>
|
||||
</resources>
|
@ -11,7 +11,7 @@
|
||||
<!-- Set theme colors from https://aka.ms/material-colors -->
|
||||
<!-- colorPrimary is used for the default action bar background -->
|
||||
<item name="colorPrimary">#2196F3</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">#1976D2</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
@ -24,4 +24,15 @@
|
||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">#FF4081</item>
|
||||
</style>
|
||||
<style name="MainTheme.Splash" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowActionBar">true</item>
|
||||
</style>
|
||||
<dimen name="design_bottom_navigation_active_text_size">11sp</dimen>
|
||||
<dimen name="design_bottom_navigation_text_size">11sp</dimen>
|
||||
<dimen name="design_bottom_navigation_margin">12dp</dimen>
|
||||
<dimen name="design_bottom_navigation_icon_size">20dp</dimen>
|
||||
</resources>
|
43
Pixiview.Android/SplashActivity.cs
Normal file
43
Pixiview.Android/SplashActivity.cs
Normal file
@ -0,0 +1,43 @@
|
||||
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() { }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user