Add AndroidTV splash screen

This commit is contained in:
Charles Lombardo 2022-08-10 15:53:45 -04:00
parent 1dff1c3fe8
commit 0c89e5ea8d
3 changed files with 14 additions and 3 deletions

View File

@ -49,7 +49,7 @@
<activity
android:name=".ui.main.MainActivity"
android:exported="true"
android:theme="@style/Theme.Dolphin.Splash">
android:theme="@style/Theme.Dolphin.Splash.Main">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
<intent-filter>
@ -62,7 +62,7 @@
<activity
android:name=".ui.main.TvMainActivity"
android:exported="true"
android:theme="@style/Theme.Dolphin.TV">
android:theme="@style/Theme.Dolphin.Splash.TV">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
<intent-filter>

View File

@ -10,6 +10,7 @@ import android.util.TypedValue;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.splashscreen.SplashScreen;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.leanback.app.BrowseSupportFragment;
@ -53,6 +54,10 @@ public final class TvMainActivity extends FragmentActivity
@Override
protected void onCreate(Bundle savedInstanceState)
{
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
splashScreen.setKeepOnScreenCondition(
() -> !DirectoryInitialization.areDolphinDirectoriesReady());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tv_main);

View File

@ -1,11 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Dolphin.Splash" parent="Theme.SplashScreen">
<style name="Theme.Dolphin.Splash.Main" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/dolphin_surface</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_dolphin</item>
<item name="postSplashScreenTheme">@style/Theme.Dolphin.Main</item>
</style>
<style name="Theme.Dolphin.Splash.TV" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/dolphin_surface</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_dolphin</item>
<item name="postSplashScreenTheme">@style/Theme.Dolphin.TV</item>
</style>
<!-- Base theme -->
<style name="Theme.Dolphin.Main" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorSurface">@color/dolphin_blue</item>