Nventive.ExtendedSplashScreen.Uno
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Nventive.ExtendedSplashScreen.Uno --version 1.0.0
NuGet\Install-Package Nventive.ExtendedSplashScreen.Uno -Version 1.0.0
<PackageReference Include="Nventive.ExtendedSplashScreen.Uno" Version="1.0.0" />
paket add Nventive.ExtendedSplashScreen.Uno --version 1.0.0
#r "nuget: Nventive.ExtendedSplashScreen.Uno, 1.0.0"
// Install Nventive.ExtendedSplashScreen.Uno as a Cake Addin #addin nuget:?package=Nventive.ExtendedSplashScreen.Uno&version=1.0.0 // Install Nventive.ExtendedSplashScreen.Uno as a Cake Tool #tool nuget:?package=Nventive.ExtendedSplashScreen.Uno&version=1.0.0
Extended SplashScreen
Extended splashscreen allows to control when to dismiss the splascreen. It also gives the developer the ability to add additional xaml content to display while the application is being loaded.
Getting Started
Install the latest version of Nventive.ExtendedSplashScreen.Uno
or Nventive.ExtendedSplashScreen.Uno.WinUI
.
In order for this package to work, you also need to setup the rootframe in app.xaml.cs to be a custom UserControl instead of a frame.
Shell rootFrame = window.Content as Shell;
// just ensure that the window is active
if (rootFrame == null)
{
// Use a UserControl that will contain the frame for naviation as a rootframe.
rootFrame = new Shell(e);
window.Content = rootFrame;
}
In the User control, you need to put a frame that will be used for navigation and which will show the content of the app, as well as the Extended splashscreen. It is important to put the Splascreen lower than the frame so that the splash screen content goes over the content of the frame.
<UserControl x:Class="ExtendedSlashScreen.Uno.Samples.Shell"
...
xmlns:splash="using:Nventive.ExtendedSplashScreen">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Frame x:Name="RootNavigationFrame" />
<splash:ExtendedSplashScreen x:Name="AppExtendedSplashScreen" />
</Grid>
</UserControl>
In the code behind of the user control you can set the splashscreen for UWP, and make a reference to the shell in Instance and make a public property to represent the ExtendedSplashscreen.
public sealed partial class Shell : UserControl
{
public static Shell Instance { get; private set; }
public Shell(LaunchActivatedEventArgs e)
{
this.InitializeComponent();
Instance = this;
#if WINDOWS_UWP
AppExtendedSplashScreen.SplashScreen = e?.SplashScreen;
#endif
NavigationFrame.Navigate(typeof(MainPage), e.Arguments);
}
public IExtendedSplashScreen ExtendedSplashScreen => this.AppExtendedSplashScreen;
public Frame NavigationFrame => this.RootNavigationFrame;
}
You can reference the instance property later for navigation and you can dismiss the ExtendedSplashScreen with this line of code:
Shell.Instance.ExtendedSplashScreen.Dismiss();
Then, all you need to do is to set the style.
<Style x:Key="DefaultExtendedSplashScreenStyle"
TargetType="splash:ExtendedSplashScreen">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="splash:ExtendedSplashScreen">
<Grid x:Name="RootGrid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SplashScreenStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Dismissed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.150"
Value="Collapsed" />
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="RootGrid"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:0.150" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="SplashScreenPresenter" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Android 12+
The native splash screen behavior changes starting at Android 12. See reference.
ExtendedSplashScreen
supports the Android 12+ behavior.
You need to add the following code in your MainActivity.cs to override the default behavior.
public sealed class MainActivity : Microsoft.UI.Xaml.ApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
// Handle the splash screen transition.
Nventive.ExtendedSplashScreen.ExtendedSplashScreen.AndroidSplashScreen = AndroidX.Core.SplashScreen.SplashScreen.InstallSplashScreen(this);
// It's important to call base.OnCreate AFTER setting ExtendedSplashScreen.AndroidSplashScreen.
base.OnCreate(bundle);
}
}
Note that when you run your app in debug from Visual Studio (or other IDEs), the new SplashScreen icon doesn't show. It shows when you run the app from the launcher (even debug builds).
Changelog
Please consult the CHANGELOG for more information about version history.
License
This project is licensed under the Apache 2.0 license - see the LICENSE file for details.
Contributing
Please read CONTRIBUTING.md for details on the process for contributing to this project.
Be mindful of our Code of Conduct.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. monoandroid12.0 is compatible. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap10.0.19041 is compatible. |
Xamarin.iOS | xamarinios was computed. xamarinios10 is compatible. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Microsoft.Extensions.Logging (>= 6.0.0)
- Uno.Core (>= 4.0.1)
- Uno.SourceGenerationTasks (>= 4.1.0)
- Uno.UI (>= 4.0.13)
-
.NETStandard 2.0
- Microsoft.Extensions.Logging (>= 6.0.0)
- Uno.Core (>= 4.0.1)
- Uno.SourceGenerationTasks (>= 4.1.0)
- Uno.UI (>= 4.0.13)
-
MonoAndroid 12.0
- Microsoft.Extensions.Logging (>= 6.0.0)
- Uno.Core (>= 4.0.1)
- Uno.SourceGenerationTasks (>= 4.1.0)
- Uno.UI (>= 4.0.13)
- Xamarin.AndroidX.Core.SplashScreen (>= 1.0.0.3)
-
UAP 10.0.19041
- Microsoft.Extensions.Logging (>= 6.0.0)
- Uno.Core (>= 4.0.1)
- Uno.SourceGenerationTasks (>= 4.1.0)
- Uno.UI (>= 4.0.13)
-
Xamarin.iOS 1.0
- Microsoft.Extensions.Logging (>= 6.0.0)
- Uno.Core (>= 4.0.1)
- Uno.SourceGenerationTasks (>= 4.1.0)
- Uno.UI (>= 4.0.13)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.2 | 6,994 | 12/13/2023 |
1.0.2-feature.Uno5Update.2 | 97 | 11/3/2023 |
1.0.1 | 4,204 | 9/25/2023 |
1.0.0 | 169 | 9/14/2023 |
1.0.0-dev.64 | 83 | 9/14/2023 |
0.7.2-dev.62 | 90 | 9/13/2023 |
0.5.0-dev.60 | 7,138 | 3/1/2023 |
0.4.0-dev.57 | 106 | 2/28/2023 |
0.4.0-dev.55 | 106 | 2/27/2023 |
0.3.0-dev.51 | 681 | 12/24/2022 |
0.3.0-dev.40 | 2,632 | 10/13/2022 |
0.3.0-dev.38 | 1,841 | 9/28/2022 |
0.3.0-dev.33 | 53,823 | 4/6/2022 |
0.2.0-dev.24 | 76,770 | 3/18/2021 |
0.1.0-dev.22 | 24,921 | 12/24/2020 |
0.1.0-dev.20 | 1,464 | 11/2/2020 |
0.1.0-dev.18 | 19,986 | 8/24/2020 |
0.1.0-dev.16 | 5,420 | 8/14/2020 |
0.1.0-dev.14 | 270 | 6/26/2020 |