Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Add splashscreen to Android app #1499

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android-app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ dependencies {
implementation(libs.androidx.browser)
implementation(libs.androidx.emoji)
implementation(libs.androidx.profileinstaller)
implementation(libs.androidx.splashscreen)

implementation(libs.kotlin.coroutines.android)

Expand Down
2 changes: 1 addition & 1 deletion android-app/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
android:launchMode="singleTask"
android:resizeableActivity="true"
android:exported="true"
android:theme="@style/Theme.Tivi.Home"
android:theme="@style/Theme.Tivi.Starting"
tools:targetApi="n">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
3 changes: 3 additions & 0 deletions android-app/app/src/main/kotlin/app/tivi/home/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import app.tivi.BuildConfig
import app.tivi.TiviActivity
Expand All @@ -27,6 +28,8 @@ import me.tatarka.inject.annotations.Provides

class MainActivity : TiviActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()

super.onCreate(savedInstanceState)
val component = MainActivityComponent::class.create(this)

Expand Down
2 changes: 1 addition & 1 deletion android-app/app/src/main/res/values-v29/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
-->

<resources>
<style name="Theme.Tivi.Immerse" parent="Theme.Tivi.NoActionBar">
<style name="Theme.Tivi.Immerse" parent="Theme.Tivi">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
Expand Down
22 changes: 13 additions & 9 deletions android-app/app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,29 @@

<style name="Platform.Theme.Tivi" parent="android:Theme.Material.Light" />

<style name="Base.Theme.Tivi" parent="Platform.Theme.Tivi">
<item name="android:windowActionModeOverlay">true</item>
</style>

<style name="Theme.Tivi" parent="Base.Theme.Tivi">
</style>

<style name="Theme.Tivi.NoActionBar">
<style name="Theme.Tivi" parent="Platform.Theme.Tivi">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>

<item name="android:statusBarColor">@android:color/transparent</item>

<item name="android:navigationBarColor">@color/nav_bar_scrim</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">@bool/use_light_nav_bar</item>
</style>

<style name="Theme.Tivi.Immerse" parent="Theme.Tivi.NoActionBar">
<style name="Theme.Tivi.Immerse" parent="Theme.Tivi">
<item name="android:statusBarColor">@android:color/transparent</item>

<item name="android:navigationBarColor">@color/nav_bar_scrim</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">@bool/use_light_nav_bar</item>
</style>

<style name="Theme.Tivi.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/launcher_icon_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>
<item name="postSplashScreenTheme">@style/Theme.Tivi.Home</item>
</style>

<style name="Theme.Tivi.Home" parent="Theme.Tivi.Immerse">
<item name="android:windowLightStatusBar">@bool/use_light_status_bar</item>
</style>
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ androidx-archCoreTesting = "androidx.arch.core:core-testing:2.2.0"
androidx-browser = "androidx.browser:browser:1.6.0"
androidx-collection = "androidx.collection:collection:1.3.0-beta01"
androidx-core = "androidx.core:core-ktx:1.10.1"
androidx-splashscreen = "androidx.core:core-splashscreen:1.0.1"
androidx-emoji = "androidx.emoji:emoji:1.1.0"

androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidxlifecycle" }
Expand Down