From 25bdd61fb914d8bab3f984598e0d8ad61e989ab4 Mon Sep 17 00:00:00 2001 From: Chiara Chiappini Date: Thu, 4 Dec 2025 21:16:30 +0000 Subject: [PATCH 1/2] More snippets: navigation and migration page --- .../wear/snippets/m3/navigation/Navigation.kt | 20 +++++++++ .../example/wear/snippets/m3/theme/Color.kt | 8 ++++ .../example/wear/snippets/m3/theme/Theme.kt | 41 +++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt diff --git a/wear/src/main/java/com/example/wear/snippets/m3/navigation/Navigation.kt b/wear/src/main/java/com/example/wear/snippets/m3/navigation/Navigation.kt index 5e1e4c12f..9ba6dc4b1 100644 --- a/wear/src/main/java/com/example/wear/snippets/m3/navigation/Navigation.kt +++ b/wear/src/main/java/com/example/wear/snippets/m3/navigation/Navigation.kt @@ -38,6 +38,26 @@ import com.example.wear.R import com.google.android.horologist.compose.layout.ColumnItemType import com.google.android.horologist.compose.layout.rememberResponsiveColumnPadding +@Composable +fun navController() { + // [START android_wear_nav_controller] + val navController = rememberSwipeDismissableNavController() + // [END android_wear_nav_controller] +} + +@Composable +fun navHost() { + // [START android_wear_nav_host] + val navController = rememberSwipeDismissableNavController() + SwipeDismissableNavHost( + navController = navController, + startDestination = "message_list" + ) { + // TODO: build navigation graph + } + // [END android_wear_nav_host] +} + @Composable fun navigation() { // [START android_wear_navigation] diff --git a/wear/src/main/java/com/example/wear/snippets/m3/theme/Color.kt b/wear/src/main/java/com/example/wear/snippets/m3/theme/Color.kt index 364168592..7ffb288ec 100644 --- a/wear/src/main/java/com/example/wear/snippets/m3/theme/Color.kt +++ b/wear/src/main/java/com/example/wear/snippets/m3/theme/Color.kt @@ -31,3 +31,11 @@ fun myApp() { internal val myBrandColors: ColorScheme = ColorScheme( /* Specify colors here */) // [END android_wear_dynamic_theme]] + +fun color() { + // [START android_wear_color] + val appColorScheme: ColorScheme = ColorScheme( + // M3 ColorScheme parameters + ) + // [END android_wear_color] +} diff --git a/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt b/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt new file mode 100644 index 000000000..1750c406d --- /dev/null +++ b/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt @@ -0,0 +1,41 @@ +/* + * 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. + */ + +package com.example.wear.snippets.m3.theme + +import androidx.compose.runtime.Composable +import androidx.wear.compose.material3.ColorScheme +import androidx.wear.compose.material3.MaterialTheme +import androidx.wear.compose.material3.Shapes +import androidx.wear.compose.material3.Typography +import androidx.wear.compose.material3.MotionScheme + +@Composable +fun materialTheme() { + val appColorScheme = ColorScheme() + val appTypography = Typography() + val appShapes = Shapes() + val appMotionScheme = MotionScheme.standard() + // [START android_wear_material_theme] + MaterialTheme( + colorScheme = appColorScheme, + typography = appTypography, + shapes = appShapes, + motionScheme = appMotionScheme, + content = { /*content here*/ } + ) + // [END android_wear_material_theme] +} \ No newline at end of file From 630763974ef378bb2879b394291b0656fe2780ed Mon Sep 17 00:00:00 2001 From: kul3r4 <820891+kul3r4@users.noreply.github.com> Date: Fri, 5 Dec 2025 10:41:12 +0000 Subject: [PATCH 2/2] Apply Spotless --- .../src/main/java/com/example/wear/snippets/m3/theme/Theme.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt b/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt index 1750c406d..f9d1aeefd 100644 --- a/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt +++ b/wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt @@ -19,9 +19,9 @@ package com.example.wear.snippets.m3.theme import androidx.compose.runtime.Composable import androidx.wear.compose.material3.ColorScheme import androidx.wear.compose.material3.MaterialTheme +import androidx.wear.compose.material3.MotionScheme import androidx.wear.compose.material3.Shapes import androidx.wear.compose.material3.Typography -import androidx.wear.compose.material3.MotionScheme @Composable fun materialTheme() { @@ -38,4 +38,4 @@ fun materialTheme() { content = { /*content here*/ } ) // [END android_wear_material_theme] -} \ No newline at end of file +}