mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-09-12 22:33:37 -04:00
Implement Wear OS splash screen
This commit is contained in:
1 parent
7c11508b12
commit
2df681a5b8
5 files changed
+25
-1
No files matched your search
@@ -49,6 +49,9 @@ dependencies {
|
||||
implementation(libs.androidx.core.core.ktx)
|
||||
implementation(libs.androidx.activity.activity.compose)
|
||||
|
||||
// AndroidX
|
||||
implementation(libs.androidx.core.core.splashscreen)
|
||||
|
||||
// Wear OS Compose
|
||||
implementation(libs.androidx.wear.compose.material3)
|
||||
implementation(libs.androidx.wear.compose.foundation)
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name">
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/Theme.App.Starting">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.navArgument
|
||||
import androidx.wear.compose.navigation.SwipeDismissableNavHost
|
||||
@@ -33,6 +34,7 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
installSplashScreen()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
WearCardRepository.loadCache(this)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#1F4262</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,14 @@
|
||||
<resources>
|
||||
<style name="Theme.App" parent="@android:style/Theme.DeviceDefault" />
|
||||
|
||||
<style name="Theme.App.Starting" parent="Theme.SplashScreen.IconBackground">
|
||||
<!--
|
||||
Google Wear OS guidelines require a black background
|
||||
See https://developer.android.com/design/ui/wear/guides/m2-5/behaviors-and-patterns/launch#branded
|
||||
-->
|
||||
<item name="windowSplashScreenBackground">@android:color/black</item>
|
||||
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
|
||||
<item name="windowSplashScreenIconBackgroundColor">@color/ic_launcher_background</item>
|
||||
<item name="postSplashScreenTheme">@style/Theme.App</item>
|
||||
</style>ss
|
||||
</resources>
|
||||
Reference in new issue
Block a user