Adds splash screen (#915)

* added splash screen

* Tweak splash screen

Always use dark background and use vector drawable without border as icon. On Android versions below N, the icon gradient is replaced with a solid white color since gradients in vector drawables aren't supported there.

* Reorder dependencies

Co-authored-by: Maxr1998 <max.rumpf1998@gmail.com>
This commit is contained in:
Susan Thapa 2022-12-05 02:53:50 +05:45 committed by GitHub
parent ffdf1eca1e
commit 5cc2483b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 1 deletions

View File

@ -114,6 +114,7 @@ dependencies {
// Core
implementation(libs.bundles.koin)
implementation(libs.androidx.core)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.activity)
implementation(libs.androidx.fragment)

View File

@ -0,0 +1,8 @@
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
android:endColor="#fdc92f"
android:endX="752"
android:endY="692"
android:startColor="#f2364d"
android:startX="366"
android:startY="469"
android:type="linear" />

View File

@ -35,7 +35,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Starting"
tools:ignore="UnusedAttribute">
<activity

View File

@ -12,6 +12,7 @@ import android.view.OrientationEventListener
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import org.jellyfin.mobile.events.ActivityEventHandler
import org.jellyfin.mobile.player.cast.Chromecast
@ -51,6 +52,7 @@ class MainActivity : AppCompatActivity() {
private val orientationListener: OrientationEventListener by lazy { SmartOrientationListener(this) }
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
setupKoinFragmentFactory()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

View File

@ -0,0 +1,8 @@
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
android:endColor="#00a4dc"
android:endX="752"
android:endY="692"
android:startColor="#aa5cc3"
android:startX="366"
android:startY="469"
android:type="linear" />

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/splash_fill"
android:pathData="m512 284.789466c-57.344 0-241.850182 334.568734-213.736727 391.074914 28.113454 56.50618 399.639277 55.85454 427.473457 0 27.83418-55.85455-156.39273-391.074914-213.73673-391.074914zm140.10182 342.109094c-18.24582 36.58473-261.67855 37.05018-280.11055 0-18.431997-37.05018 102.49309-256.27928 140.00873-256.27928s158.34764 219.60146 140.10182 256.27928zm-140.10182-176.128c-18.99055 0-80.24436 111.05745-70.93527 129.76873 9.30909 18.71127 132.65454 18.52509 141.87054 0s-51.85163-129.76873-70.93527-129.76873z" />
</vector>

View File

@ -9,6 +9,9 @@
<!-- Launcher icon background -->
<color name="ic_launcher_background">#000b25</color>
<!-- Splash logo color for API < 24. API >= 24 will have the default gradient. -->
<color name="splash_fill">#fafafa</color>
<!-- App colors -->
<color name="theme_background">#101010</color>
<color name="playback_controls_background">#60000000</color>

View File

@ -10,6 +10,12 @@
<style name="AppTheme" parent="AppTheme.V21" />
<style name="AppTheme.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/theme_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
<!-- Settings theme -->
<style name="AppTheme.Settings" />

View File

@ -14,6 +14,7 @@ coroutines = "1.6.4"
koin = "3.3.0"
koin-compose = "3.3.0"
androidx-core = "1.9.0"
androidx-core-splashscreen = "1.0.0"
androidx-appcompat = "1.5.1"
androidx-activity = "1.6.1"
androidx-fragment = "1.5.4"
@ -78,6 +79,7 @@ coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutin
koin = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" }
koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin-compose" }
androidx-core = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core" }
androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidx-core-splashscreen" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-activity = { group = "androidx.activity", name = "activity-ktx", version.ref = "androidx-activity" }
androidx-fragment = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidx-fragment" }