Merge pull request #10948 from t895/splash

Android: Add Androidx splash screen to wait for directory initialization
This commit is contained in:
JosJuice 2022-08-11 20:05:46 +02:00 committed by GitHub
commit ce08de8cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 4 deletions

View File

@ -103,6 +103,7 @@ dependencies {
implementation 'androidx.fragment:fragment:1.4.1'
implementation 'androidx.slidingpanelayout:slidingpanelayout:1.2.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.core:core-splashscreen:1.0.0'
// Android TV UI libraries.
implementation 'androidx.leanback:leanback:1.0.0'

View File

@ -49,20 +49,20 @@
<activity
android:name=".ui.main.MainActivity"
android:exported="true"
android:theme="@style/Theme.Dolphin.Main">
android:theme="@style/Theme.Dolphin.Splash.Main">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<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

@ -14,6 +14,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.splashscreen.SplashScreen;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager.widget.ViewPager;
@ -55,6 +56,10 @@ public final class MainActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState)
{
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
splashScreen.setKeepOnScreenCondition(
() -> !DirectoryInitialization.areDolphinDirectoriesReady());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

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);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,20 @@
<vector android:height="192dp" android:viewportHeight="500"
android:viewportWidth="500" android:width="192dp"
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#0057AB" android:fillType="nonZero"
android:pathData="M362.51,306.61C361.76,304.1 357.09,288.95 349.22,274.43C338.85,255.3 329.93,241.62 315.07,227.73C310.29,223.26 305.77,219.27 301.05,215.68L301.06,215.68C301.06,215.68 301.02,215.66 300.96,215.61C300.87,215.54 300.78,215.47 300.69,215.41C298.93,214.05 291.52,207.81 294.16,200.91C295.04,198.6 297.18,196.68 299.71,195.13L313.36,195.02L313.36,189.96L313.36,189.96C313.36,189.96 313.36,189.96 313.36,189.96C313.36,189.96 305.37,187.24 291.38,188.14C278.26,188.98 266.46,196.66 264.26,197.74C257.19,195.71 249.12,193.93 239.69,192.33C207.06,186.79 179.45,195.62 165.59,205.24C147.43,217.84 147.93,229.59 146.44,235.46C145.51,239.1 137.26,245.83 137.36,250.55L137.36,255.52L139.07,257.28L145.49,255.09L146.26,252.41C148.9,251.47 151.79,250.15 154.42,249.07C160.98,246.38 161.48,244.91 179.41,242.24C187.65,241.01 196.33,240.65 202.79,240.6C205.3,245.91 211.55,256.82 222.38,262.05C229.43,265.46 237.32,267.2 243.6,268.09L242.78,272.24L255.28,274.09L255.28,269.03L255.27,269.03C255.27,269.03 255.27,269.03 255.27,269.03C255.27,269.03 244.78,264.67 238.32,258.21C233.92,253.82 232.87,247.14 232.65,243.32L232.69,243.33C243.27,245.34 252.51,246.79 274.61,255.25C278.7,256.82 282.52,258.54 285.99,260.27L285.34,260.64L295.3,268.67L307.2,278.52L307.2,273.46L307.16,273.43C306.98,273.21 293.43,256.42 270.66,245.19C251.84,235.91 236.38,231.32 214.97,230.28C191.57,229.15 174.33,232.15 174.33,232.15C174.33,232.15 174.81,221.75 192.48,213.46C207.84,206.26 232.01,205.05 259.75,212.13C298.94,222.13 312.3,239.15 329.16,256.74C339.85,267.9 349.69,283.61 355.88,294.47L354.84,294L358.05,302.3L362.64,312.1L362.64,307.01L362.51,306.61z"
android:strokeColor="#00000000" android:strokeLineCap="butt"
android:strokeLineJoin="miter" android:strokeWidth="0.11"/>
<path android:fillType="nonZero"
android:pathData="M349.22,279.48C338.85,260.35 329.93,246.67 315.08,232.78C310.3,228.31 305.77,224.32 301.06,220.73L301.06,220.73C301.06,220.73 301.02,220.71 300.96,220.66C300.87,220.59 300.79,220.53 300.7,220.46C298.95,219.11 291.53,212.86 294.16,205.97C297.06,198.4 313.36,195.01 313.36,195.01C313.36,195.01 305.37,192.3 291.39,193.19C278.26,194.04 266.47,201.71 264.26,202.79C257.19,200.77 249.13,198.98 239.69,197.38C207.07,191.85 179.45,200.67 165.6,210.29C147.44,222.89 147.94,234.64 146.44,240.51C145.36,244.74 134.41,253.14 138.13,257.71C140.46,260.57 148.19,256.69 154.42,254.13C160.98,251.43 161.49,249.96 179.41,247.29C187.65,246.06 196.33,245.7 202.79,245.65C205.31,250.96 211.56,261.87 222.39,267.1C237.01,274.17 255.28,274.08 255.28,274.08C255.28,274.08 244.78,269.72 238.32,263.26C233.93,258.87 232.87,252.19 232.65,248.38L232.69,248.38C243.27,250.39 252.51,251.84 274.62,260.31C293.96,267.71 307.17,278.48 307.17,278.48C307.17,278.48 293.59,261.55 270.66,250.24C251.84,240.96 236.39,236.37 214.98,235.33C191.57,234.2 174.33,237.2 174.33,237.2C174.33,237.2 174.81,226.8 192.48,218.52C207.84,211.31 232.01,210.1 259.75,217.18C298.94,227.18 312.31,244.2 329.16,261.79C347.1,280.52 362.62,312.03 362.62,312.03C362.62,312.03 357.84,295.38 349.22,279.48z"
android:strokeColor="#00000000" android:strokeLineCap="butt"
android:strokeLineJoin="miter" android:strokeWidth="0.11">
<aapt:attr name="android:fillColor">
<gradient android:endX="137.36" android:endY="312.04"
android:startX="137.36" android:startY="193.02" android:type="linear">
<item android:color="#FF46D4FF" android:offset="0"/>
<item android:color="#FF1792FF" android:offset="1"/>
</gradient>
</aapt:attr>
</path>
</vector>

View File

@ -4,6 +4,8 @@
<color name="dolphin_blue_secondary">#2196f3</color>
<color name="dolphin_white">#FFFFFF</color>
<color name="dolphin_surface">#1A1C1E</color>
<color name="tv_card_unselected">#444444</color>
<color name="invalid_setting_overlay">#36ff0000</color>

View File

@ -4,6 +4,8 @@
<color name="dolphin_blue_secondary">#21b0f3</color>
<color name="dolphin_white">#ffffff</color>
<color name="dolphin_surface">#FDFCFF</color>
<color name="tv_card_unselected">#444444</color>
<color name="invalid_setting_overlay">#36ff0000</color>

View File

@ -1,5 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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>