Skip to content
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
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ coil = "2.7.0"
compileSdk = "36"
compose-latest = "1.9.4"
composeUiTooling = "1.5.4"
coreSplashscreen = "1.0.1"
coreSplashscreen = "1.2.0"
coroutines = "1.10.2"
dataStore = "1.1.7"
datastoreCore = "1.1.7"
Expand Down
17 changes: 17 additions & 0 deletions wear/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@android:style/Theme.DeviceDefault">

<!-- [START android_wear_splash_manifest] -->
<activity
android:name=".snippets.SplashScreenActivity"
android:exported="true"
android:taskAffinity=""
android:theme="@style/Theme.App.Starting">
<!-- [START_EXCLUDE] -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- [END_EXCLUDE] -->
</activity>
<!-- [END android_wear_splash_manifest] -->

<uses-library
android:name="com.google.android.wearable"
android:required="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.wear.snippets

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen

// [START android_wear_splash_activity]
class SplashScreenActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)

setContent {
WearApp()
}
}
}
// [END android_wear_splash_activity]
25 changes: 25 additions & 0 deletions wear/src/main/res/drawable/splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- [START android_wear_splash_drawable] -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="@dimen/splash_screen_icon_size"
android:height="@dimen/splash_screen_icon_size"
android:drawable="@mipmap/ic_launcher"
android:gravity="center" />
</layer-list>
<!-- [END android_wear_splash_drawable] -->
22 changes: 22 additions & 0 deletions wear/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- [START android_wear_splash_dimens] -->
<resources>
<!-- Round app icon can take all of default space -->
<dimen name="splash_screen_icon_size">48dp</dimen>
</resources>
<!-- [END android_wear_splash_dimens] -->
31 changes: 31 additions & 0 deletions wear/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- [START android_wear_splash_style] -->
<resources>
<style name="Theme.App" parent="@android:style/Theme.DeviceDefault" />

<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<!-- Set the splash screen background to black -->
<item name="windowSplashScreenBackground">@android:color/black</item>
<!-- Use windowSplashScreenAnimatedIcon to add a drawable or an animated
drawable. -->
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_screen</item>
<!-- Set the theme of the Activity that follows your splash screen. -->
<item name="postSplashScreenTheme">@style/Theme.App</item>
</style>
</resources>
<!-- [END android_wear_splash_style] -->
22 changes: 22 additions & 0 deletions wear/src/main/res_other/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- [START android_wear_splash_dimens_other] -->
<resources>
<!-- Non-round icon with background must use reduced size to fit circle -->
<dimen name="splash_screen_icon_size">36dp</dimen>
</resources>
<!-- [END android_wear_splash_dimens_other] -->
26 changes: 26 additions & 0 deletions wear/src/main/res_other/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<style name="Theme.App" parent="@android:style/Theme.DeviceDefault" />

<!-- [START android_wear_splash_style_other] -->
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<!-- Set a white background behind the splash screen icon. -->
<item name="windowSplashScreenIconBackgroundColor">@android:color/white</item>
</style>
<!-- [END android_wear_splash_style_other] -->
</resources>