Skip to content

Commit 3f4078e

Browse files
authored
Wear snippets: navigation and migration page (#726)
* More snippets: navigation and migration page * Apply Spotless --------- Co-authored-by: kul3r4 <[email protected]>
1 parent 0694ab8 commit 3f4078e

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

wear/src/main/java/com/example/wear/snippets/m3/navigation/Navigation.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ import com.example.wear.R
3838
import com.google.android.horologist.compose.layout.ColumnItemType
3939
import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadding
4040

41+
@Composable
42+
fun navController() {
43+
// [START android_wear_nav_controller]
44+
val navController = rememberSwipeDismissableNavController()
45+
// [END android_wear_nav_controller]
46+
}
47+
48+
@Composable
49+
fun navHost() {
50+
// [START android_wear_nav_host]
51+
val navController = rememberSwipeDismissableNavController()
52+
SwipeDismissableNavHost(
53+
navController = navController,
54+
startDestination = "message_list"
55+
) {
56+
// TODO: build navigation graph
57+
}
58+
// [END android_wear_nav_host]
59+
}
60+
4161
@Composable
4262
fun navigation() {
4363
// [START android_wear_navigation]

wear/src/main/java/com/example/wear/snippets/m3/theme/Color.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ fun myApp() {
3131

3232
internal val myBrandColors: ColorScheme = ColorScheme( /* Specify colors here */)
3333
// [END android_wear_dynamic_theme]]
34+
35+
fun color() {
36+
// [START android_wear_color]
37+
val appColorScheme: ColorScheme = ColorScheme(
38+
// M3 ColorScheme parameters
39+
)
40+
// [END android_wear_color]
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.wear.snippets.m3.theme
18+
19+
import androidx.compose.runtime.Composable
20+
import androidx.wear.compose.material3.ColorScheme
21+
import androidx.wear.compose.material3.MaterialTheme
22+
import androidx.wear.compose.material3.MotionScheme
23+
import androidx.wear.compose.material3.Shapes
24+
import androidx.wear.compose.material3.Typography
25+
26+
@Composable
27+
fun materialTheme() {
28+
val appColorScheme = ColorScheme()
29+
val appTypography = Typography()
30+
val appShapes = Shapes()
31+
val appMotionScheme = MotionScheme.standard()
32+
// [START android_wear_material_theme]
33+
MaterialTheme(
34+
colorScheme = appColorScheme,
35+
typography = appTypography,
36+
shapes = appShapes,
37+
motionScheme = appMotionScheme,
38+
content = { /*content here*/ }
39+
)
40+
// [END android_wear_material_theme]
41+
}

0 commit comments

Comments
 (0)