Add splash screen

This commit is contained in:
Jarne Demeulemeester 2021-07-04 12:29:17 +02:00
parent 55e7b64628
commit 4342448c1e
No known key found for this signature in database
GPG key ID: 60884A0C1EBA43E5
5 changed files with 20 additions and 4 deletions

View file

@ -6,7 +6,7 @@ plugins {
} }
android { android {
compileSdkVersion 30 compileSdkVersion 'android-S'
buildToolsVersion "30.0.3" buildToolsVersion "30.0.3"
defaultConfig { defaultConfig {
@ -43,6 +43,7 @@ dependencies {
def jellyfin_version = "1.0.0-beta.9" def jellyfin_version = "1.0.0-beta.9"
implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.core:core-splashscreen:1.0.0-alpha01'
implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.appcompat:appcompat:1.3.0'
// Material // Material

View file

@ -16,7 +16,8 @@
android:label="@string/title_activity_main" /> android:label="@string/title_activity_main" />
<activity <activity
android:name=".SetupActivity" android:name=".SetupActivity"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan"
android:theme="@style/Theme.JellyfinSplashScreen">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View file

@ -2,10 +2,12 @@ package dev.jdtech.jellyfin
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
class SetupActivity : AppCompatActivity() { class SetupActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
installSplashScreen()
setContentView(R.layout.activity_setup) setContentView(R.layout.activity_setup)
} }
} }

View file

@ -10,9 +10,15 @@
<item name="colorSecondaryVariant">@color/secondary_variant</item> <item name="colorSecondaryVariant">@color/secondary_variant</item>
<item name="colorOnSecondary">@color/black</item> <item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="android:windowBackground">@color/neutral_900</item> <item name="android:windowBackground">@color/neutral_900</item>
<item name="android:colorBackgroundFloating">@color/neutral_900</item> <item name="android:colorBackgroundFloating">@color/neutral_900</item>
</style> </style>
<style name="Theme.JellyfinSplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="windowSplashScreenBackground">@color/neutral_900</item>
<item name="postSplashScreenTheme">@style/Theme.Jellyfin</item>
</style>
</resources> </resources>

View file

@ -10,9 +10,15 @@
<item name="colorSecondaryVariant">@color/secondary_variant</item> <item name="colorSecondaryVariant">@color/secondary_variant</item>
<item name="colorOnSecondary">@color/black</item> <item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="android:windowBackground">@color/neutral_100</item> <item name="android:windowBackground">@color/neutral_100</item>
<item name="android:colorBackgroundFloating">@color/neutral_100</item> <item name="android:colorBackgroundFloating">@color/neutral_100</item>
</style> </style>
<style name="Theme.JellyfinSplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="windowSplashScreenBackground">@color/neutral_100</item>
<item name="postSplashScreenTheme">@style/Theme.Jellyfin</item>
</style>
</resources> </resources>