Skip to content

Commit b899aaf

Browse files
committed
Wire AndroidX SplashScreen for the XML sample HostActivity
Add a dedicated Theme.App.Splash extending Theme.SplashScreen so the new brand splash works on every supported API level (minSdk = 21) instead of only API 31+. Background uses ic_launcher_background and the animated icon points at the launcher mipmap; postSplashScreenTheme hands control back to AppTheme once the splash dismisses. HostActivity calls installSplashScreen() before super.onCreate(). Mirrors the wiring already in place for the Compose sample so both samples share the same splash treatment for the upcoming Lottie animation.
1 parent eebb0d4 commit b899aaf

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

stream-chat-android-ui-components-sample/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ dependencies {
152152
implementation(libs.androidx.activity.ktx)
153153
implementation(libs.androidx.appcompat)
154154
implementation(libs.androidx.core.ktx)
155+
implementation(libs.androidx.core.splashscreen)
155156
implementation(libs.androidx.lifecycle.livedata.ktx)
156157
implementation(libs.androidx.preference)
157158
implementation(libs.androidx.constraintlayout)

stream-chat-android-ui-components-sample/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<activity
5151
android:name="io.getstream.chat.ui.sample.feature.HostActivity"
5252
android:exported="true"
53+
android:theme="@style/Theme.App.Splash"
5354
android:windowSoftInputMode="adjustResize"
5455
>
5556
<intent-filter>

stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/HostActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import android.content.Intent
2121
import android.os.Bundle
2222
import android.view.View
2323
import androidx.appcompat.app.AppCompatActivity
24+
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
2425
import androidx.core.view.ViewCompat
2526
import androidx.core.view.WindowInsetsCompat
2627
import androidx.core.view.updatePadding
@@ -34,6 +35,7 @@ const val EXTRA_PARENT_MESSAGE_ID = "extra_parent_message_id"
3435
class HostActivity : AppCompatActivity(R.layout.activity_main) {
3536

3637
override fun onCreate(savedInstanceState: Bundle?) {
38+
installSplashScreen()
3739
super.onCreate(savedInstanceState)
3840
setupEdgeToEdge()
3941
if (savedInstanceState != null && lastNonConfigurationInstance == null) {

stream-chat-android-ui-components-sample/src/main/res/values/themes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@
3333
<style name="AudioRecordPlayerViewTheme" parent="StreamUi.AudioRecordPlayerView">
3434
<item name="streamUiAudioRecordPlayerFileIconContainerVisible">false</item>
3535
</style>
36+
37+
<style name="Theme.App.Splash" parent="Theme.SplashScreen">
38+
<item name="windowSplashScreenBackground">@color/ic_launcher_background</item>
39+
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item>
40+
<item name="postSplashScreenTheme">@style/AppTheme</item>
41+
</style>
3642
</resources>

0 commit comments

Comments
 (0)