Skip to content

Commit

Permalink
Integrated Splash Screen API
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-chernysh committed Apr 17, 2024
1 parent 468f2ce commit c203a3d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:name="com.mobiledevpro.app.MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.AppTemplateCompose">
android:theme="@style/Theme.AppTemplateCompose.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/kotlin/com/mobiledevpro/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.runtime.getValue
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.mobiledevpro.app.ui.MainApp
Expand All @@ -13,6 +14,7 @@ import com.mobiledevpro.ui.theme.darkModeState
class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)

//False - allows to drawing the content "edge-to-edge"
Expand Down
Binary file added app/src/main/res/drawable/ic_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
<resources>

<style name="Theme.AppTemplateCompose" parent="android:Theme.Material.Light.NoActionBar" />

<style name="Theme.AppTemplateCompose.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/launcher_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash</item>
<item name="postSplashScreenTheme">@style/Theme.AppTemplateCompose</item>
</style>
</resources>
1 change: 1 addition & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dependencies {
api(libs.bundles.lifecycle)
api(libs.coil)
api(libs.lottie)
api(libs.splash.screen)
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ koin-compose = "3.5.3"
coroutines-android = "1.8.0"
workmanager = "2.9.0"
inapp-update = "2.1.0"
splash-screen = "1.1.0-rc01"

# Firebase
firebase-bom = "32.8.1"
Expand Down Expand Up @@ -83,6 +84,7 @@ workmanager = { module = "androidx.work:work-runtime-ktx", version.ref = "workma
desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugaring" }
inapp-update = { module = "com.google.android.play:app-update", version.ref = "inapp-update" }
inapp-update-ext = { module = "com.google.android.play:app-update-ktx", version.ref = "inapp-update" }
splash-screen = { module = "androidx.core:core-splashscreen", version.ref = "splash-screen" }

# Compose
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
Expand Down

0 comments on commit c203a3d

Please sign in to comment.