Added a splash screen to Android sample

This commit is contained in:
Matthew Leibowitz 2016-09-20 20:31:26 +02:00
Родитель 3d85fdf244
Коммит c30f681722
7 изменённых файлов: 53 добавлений и 11 удалений

Просмотреть файл

@ -6,7 +6,7 @@ using Xamarin.Forms.Platform.Android;
namespace SkiaSharpSample.FormsSample.Platform
{
[Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[Activity(ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
@ -16,8 +16,6 @@ namespace SkiaSharpSample.FormsSample.Platform
base.OnCreate(bundle);
SamplesInitializer.Init();
Forms.Init(this, bundle);
LoadApplication(new App());
}

Просмотреть файл

@ -2205,11 +2205,17 @@ namespace SkiaSharpSample.FormsSample.Platform
// aapt resource value: 0x7f0200a1
public const int mr_ic_play_light = 2130837665;
// aapt resource value: 0x7f0200a3
public const int notification_template_icon_bg = 2130837667;
// aapt resource value: 0x7f0200a5
public const int notification_template_icon_bg = 2130837669;
// aapt resource value: 0x7f0200a2
public const int slideshow = 2130837666;
public const int skia = 2130837666;
// aapt resource value: 0x7f0200a3
public const int slideshow = 2130837667;
// aapt resource value: 0x7f0200a4
public const int splash = 2130837668;
static Drawable()
{
@ -3543,6 +3549,9 @@ namespace SkiaSharpSample.FormsSample.Platform
// aapt resource value: 0x7f0a0173
public const int MainTheme_Base = 2131362163;
// aapt resource value: 0x7f0a0175
public const int MainTheme_Splash = 2131362165;
// aapt resource value: 0x7f0a0032
public const int Platform_AppCompat = 2131361842;

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="#F8F8F8" />
</item>
<item>
<bitmap android:src="@drawable/skia" android:tileMode="disabled" android:gravity="center" />
</item>
</layer-list>

Просмотреть файл

@ -29,4 +29,9 @@
<item name="colorAccent">#FF4081</item>
</style>
<style name="MainTheme.Splash" parent ="Theme.AppCompat.Light">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>

Просмотреть файл

@ -17,8 +17,8 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
<AndroidStoreUncompressedFileExtensions />
<MandroidI18n />
<JavaMaximumHeapSize />
@ -45,8 +45,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidLinkMode>Full</AndroidLinkMode>
<EnableProguard>true</EnableProguard>
</PropertyGroup>
@ -134,6 +133,7 @@
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SplashActivity.cs" />
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="..\..\SkiaSharpSample.Shared\Media\content-font.ttf">
@ -157,10 +157,12 @@
<AndroidResource Include="Resources\layout\Tabbar.axml" />
<AndroidResource Include="Resources\layout\Toolbar.axml" />
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\drawable\splash.xml" />
<AndroidResource Include="Resources\drawable\skia.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SkiaSharpSample.FormsSample\SkiaSharpSample.FormsSample.csproj">
<Project>{e3d24d5e-80b0-45e1-ad55-d69d00bfa5f8}</Project>
<Project>{E01FBABA-8DA1-432B-9253-F4ABE13A3A6A}</Project>
<Name>SkiaSharpSample.FormsSample</Name>
</ProjectReference>
</ItemGroup>

Просмотреть файл

@ -0,0 +1,19 @@
using Android.App;
using Android.Content;
using Android.Support.V7.App;
namespace SkiaSharpSample.FormsSample.Platform
{
[Activity(Theme = "@style/MainTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : AppCompatActivity
{
protected override void OnResume()
{
base.OnResume();
SamplesInitializer.Init();
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
}
}
}