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
21 changes: 12 additions & 9 deletions wear/src/main/java/com/example/wear/snippets/m3/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ package com.example.wear.snippets.m3.theme

import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
// [START android_wear_color]
import androidx.wear.compose.material3.ColorScheme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being able to see the exact import is a good benefit of snippets, but I wonder if they can just be left in the GH source, rather than being visible on DAC. Among other things, you can only do this for the first snippet in the file (because of the way the EXCLUDE mechanism works).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree this approach has limitations and I have been trying to find other ways without much success. This case for showing imports is only for the migration guidance where we wanted to show the imports for clarity but unfortunately imports cannot be duplicated in the same file, so the only alternative is to create a new file for each one

// [START_EXCLUDE]
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.dynamicColorScheme


fun color() {
// [END_EXCLUDE]
val appColorScheme: ColorScheme = ColorScheme(
// M3 ColorScheme parameters
)
// [END android_wear_color]
}

// [START android_wear_dynamic_theme]
@Composable
fun myApp() {
Expand All @@ -30,12 +41,4 @@ 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]
}
// [END android_wear_dynamic_theme]
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/

package com.example.wear.snippets.m3.theme

// [START android_wear_shape]
import androidx.wear.compose.material3.Shapes

// [START android_wear_shape]
val Shapes = Shapes(
// M3 Shapes parameters
)
Expand Down
16 changes: 7 additions & 9 deletions wear/src/main/java/com/example/wear/snippets/m3/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,21 @@ package com.example.wear.snippets.m3.theme

import androidx.compose.runtime.Composable
import androidx.wear.compose.material3.ColorScheme
// [START android_wear_material_theme]
import androidx.wear.compose.material3.MaterialTheme
// [START_EXCLUDE]
import androidx.wear.compose.material3.MotionScheme
import androidx.wear.compose.material3.Shapes
import androidx.wear.compose.material3.Typography

@Composable
fun materialTheme() {
val appColorScheme = ColorScheme()
val appTypography = Typography()
val appShapes = Shapes()
val appMotionScheme = MotionScheme.standard()
// [START android_wear_material_theme]
// [END_EXCLUDE]
MaterialTheme(
colorScheme = appColorScheme,
typography = appTypography,
shapes = appShapes,
motionScheme = appMotionScheme,
colorScheme = ColorScheme(),
typography = Typography(),
shapes = Shapes(),
motionScheme = MotionScheme.standard(),
content = { /*content here*/ }
)
// [END android_wear_material_theme]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/

package com.example.wear.snippets.m3.theme

// [START android_wear_typography]
import androidx.wear.compose.material3.Typography

// [START android_wear_typography]
val Typography = Typography(
// M3 TextStyle parameters
)
Expand Down