Skip to content
Merged
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
18 changes: 11 additions & 7 deletions wear/src/main/java/com/example/wear/snippets/tile/GetStarted.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import androidx.wear.protolayout.DimensionBuilders.expand
import androidx.wear.protolayout.LayoutElementBuilders.FontSetting.roundness
import androidx.wear.protolayout.LayoutElementBuilders.FontSetting.weight
import androidx.wear.protolayout.LayoutElementBuilders.FontSetting.width
import androidx.wear.protolayout.material3.ButtonColors
import androidx.wear.protolayout.material3.ButtonDefaults.filledButtonColors
import androidx.wear.protolayout.material3.ButtonDefaults.filledVariantButtonColors
import androidx.wear.protolayout.material3.ColorScheme
import androidx.wear.protolayout.material3.MaterialScope
import androidx.wear.protolayout.material3.PrimaryLayoutMargins.Companion.MAX_PRIMARY_LAYOUT_MARGIN
import androidx.wear.protolayout.material3.Typography.BODY_MEDIUM
Expand All @@ -41,7 +43,7 @@ import androidx.wear.tiles.TileService
private fun TileService.materialscope1(
context: Context,
requestParams: RequestBuilders.TileRequest,
myFallbackColorScheme: androidx.wear.protolayout.material3.ColorScheme
myFallbackColorScheme: ColorScheme
) =
// [START android_wear_tile_getstarted_materialscope1]
materialScope(
Expand All @@ -65,18 +67,19 @@ private fun TileService.materialscope1(
// [END android_wear_tile_getstarted_materialscope1]

private fun TileService.materialscope2(
context: Context,
requestParams: RequestBuilders.TileRequest
) {
// [START android_wear_tile_getstarted_materialscope2]
val myColorScheme =
androidx.wear.protolayout.material3.ColorScheme(
ColorScheme(
primary = Color.rgb(0, 0, 255).argb, // Blue
onPrimary = Color.rgb(255, 255, 255).argb, // White
// 27 more
)

materialScope(
context = this,
context = context,
deviceConfiguration = requestParams.deviceConfiguration,
defaultColorScheme = myColorScheme
) {
Expand Down Expand Up @@ -124,17 +127,18 @@ public fun MaterialScope.textEdgeButton2() =
// [END android_wear_tile_getstarted_textedgebutton2]

private fun TileService.materialscope3(
context: Context,
requestParams: RequestBuilders.TileRequest
) {
// [START android_wear_tile_getstarted_materialscope3]
val myColorScheme =
androidx.wear.protolayout.material3.ColorScheme(
ColorScheme(
primary = Color.rgb(0, 0, 255).argb,
onPrimary = Color.rgb(255, 255, 255).argb,
)

// [START android_wear_tile_getstarted_materialscope3]
materialScope(
context = this,
context = context,
deviceConfiguration = requestParams.deviceConfiguration,
allowDynamicTheme = false,
defaultColorScheme = myColorScheme
Expand Down Expand Up @@ -182,7 +186,7 @@ private fun MaterialScope.textEdgeButton3() =
// [START android_wear_tile_getstarted_textedgebutton3]
textEdgeButton(
colors =
androidx.wear.protolayout.material3.ButtonColors(
ButtonColors(
// the materialScope makes colorScheme available
containerColor = colorScheme.secondary,
iconColor = colorScheme.secondaryDim,
Expand Down