Skip to content

Commit 4f463a3

Browse files
authored
Implement splash screen with red background to match XML version branding (#43)
* feat: implement splash screen with red background for brand consistency - Add SplashScreen API implementation to match XML version's red background - Create custom splash theme in core:designsystem module - Add Pokemon-themed splash icon and red background - Ensure smooth transition from splash to main content - Maintain brand consistency between XML and Compose versions * Applied Spotless check * Delete implementation from gradle:app because we are already adding splash from core:designsystem
1 parent 322a907 commit 4f463a3

File tree

7 files changed

+34
-1
lines changed

7 files changed

+34
-1
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ xmlns:tools="http://schemas.android.com/tools">
2626
android:icon="@mipmap/ic_launcher"
2727
android:label="@string/app_name"
2828
android:supportsRtl="true"
29-
android:theme="@style/Theme.PokedexCompose"
29+
android:theme="@style/Theme.PokedexCompose.Splash"
3030
tools:ignore="AllowBackup">
3131

3232
<activity

app/src/main/kotlin/com/skydoves/pokedex/compose/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.activity.ComponentActivity
2121
import androidx.activity.compose.setContent
2222
import androidx.activity.enableEdgeToEdge
2323
import androidx.compose.runtime.CompositionLocalProvider
24+
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
2425
import com.skydoves.pokedex.compose.core.navigation.AppComposeNavigator
2526
import com.skydoves.pokedex.compose.core.navigation.LocalComposeNavigator
2627
import com.skydoves.pokedex.compose.core.navigation.PokedexScreen
@@ -35,6 +36,7 @@ class MainActivity : ComponentActivity() {
3536
internal lateinit var composeNavigator: AppComposeNavigator<PokedexScreen>
3637

3738
override fun onCreate(savedInstanceState: Bundle?) {
39+
installSplashScreen()
3840
enableEdgeToEdge()
3941
super.onCreate(savedInstanceState)
4042

core/designsystem/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ dependencies {
1515
api(libs.landscapist.placeholder)
1616
api(libs.landscapist.palette)
1717

18+
// splash screen
19+
api(libs.androidx.core.splashscreen)
20+
1821
api(libs.androidx.compose.runtime)
1922
api(libs.androidx.compose.ui)
2023
api(libs.androidx.compose.ui.tooling)
35.5 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Designed and developed by 2024 skydoves (Jaewoong Eum)
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:drawable="@drawable/ic_logo"
19+
android:inset="32dp"
20+
/>

core/designsystem/src/main/res/values/styles.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@
2121
<item name="android:navigationBarColor">@android:color/transparent</item>
2222
</style>
2323

24+
<style name="Theme.PokedexCompose.Splash" parent="Theme.SplashScreen">
25+
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash</item>
26+
<item name="windowSplashScreenBackground">@color/colorPrimary</item>
27+
<item name="postSplashScreenTheme">@style/Theme.PokedexCompose</item>
28+
</style>
29+
2430
</resources>

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[versions]
22
agp = "8.12.0"
3+
coreSplashscreen = "1.0.1"
34
kotlin = "2.2.10"
45
ksp = "2.2.0-2.0.2"
56
kotlinxImmutable = "0.4.0"
@@ -38,6 +39,7 @@ spotless = "6.25.0"
3839
baselineprofile = "1.4.0"
3940

4041
[libraries]
42+
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" }
4143
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidxRoom" }
4244
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "androidxRoom" }
4345
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidxRoom" }

0 commit comments

Comments
 (0)