Skip to content

Commit 95aeebd

Browse files
Improve namespacing and clarity (#705)
1 parent 940d737 commit 95aeebd

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

wear/src/main/java/com/example/wear/snippets/tile/GetStarted.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import androidx.wear.protolayout.DimensionBuilders.expand
2222
import androidx.wear.protolayout.LayoutElementBuilders.FontSetting.roundness
2323
import androidx.wear.protolayout.LayoutElementBuilders.FontSetting.weight
2424
import androidx.wear.protolayout.LayoutElementBuilders.FontSetting.width
25+
import androidx.wear.protolayout.material3.ButtonColors
2526
import androidx.wear.protolayout.material3.ButtonDefaults.filledButtonColors
2627
import androidx.wear.protolayout.material3.ButtonDefaults.filledVariantButtonColors
28+
import androidx.wear.protolayout.material3.ColorScheme
2729
import androidx.wear.protolayout.material3.MaterialScope
2830
import androidx.wear.protolayout.material3.PrimaryLayoutMargins.Companion.MAX_PRIMARY_LAYOUT_MARGIN
2931
import androidx.wear.protolayout.material3.Typography.BODY_MEDIUM
@@ -41,7 +43,7 @@ import androidx.wear.tiles.TileService
4143
private fun TileService.materialscope1(
4244
context: Context,
4345
requestParams: RequestBuilders.TileRequest,
44-
myFallbackColorScheme: androidx.wear.protolayout.material3.ColorScheme
46+
myFallbackColorScheme: ColorScheme
4547
) =
4648
// [START android_wear_tile_getstarted_materialscope1]
4749
materialScope(
@@ -65,18 +67,19 @@ private fun TileService.materialscope1(
6567
// [END android_wear_tile_getstarted_materialscope1]
6668

6769
private fun TileService.materialscope2(
70+
context: Context,
6871
requestParams: RequestBuilders.TileRequest
6972
) {
7073
// [START android_wear_tile_getstarted_materialscope2]
7174
val myColorScheme =
72-
androidx.wear.protolayout.material3.ColorScheme(
75+
ColorScheme(
7376
primary = Color.rgb(0, 0, 255).argb, // Blue
7477
onPrimary = Color.rgb(255, 255, 255).argb, // White
7578
// 27 more
7679
)
7780

7881
materialScope(
79-
context = this,
82+
context = context,
8083
deviceConfiguration = requestParams.deviceConfiguration,
8184
defaultColorScheme = myColorScheme
8285
) {
@@ -124,17 +127,18 @@ public fun MaterialScope.textEdgeButton2() =
124127
// [END android_wear_tile_getstarted_textedgebutton2]
125128

126129
private fun TileService.materialscope3(
130+
context: Context,
127131
requestParams: RequestBuilders.TileRequest
128132
) {
129-
// [START android_wear_tile_getstarted_materialscope3]
130133
val myColorScheme =
131-
androidx.wear.protolayout.material3.ColorScheme(
134+
ColorScheme(
132135
primary = Color.rgb(0, 0, 255).argb,
133136
onPrimary = Color.rgb(255, 255, 255).argb,
134137
)
135138

139+
// [START android_wear_tile_getstarted_materialscope3]
136140
materialScope(
137-
context = this,
141+
context = context,
138142
deviceConfiguration = requestParams.deviceConfiguration,
139143
allowDynamicTheme = false,
140144
defaultColorScheme = myColorScheme
@@ -182,7 +186,7 @@ private fun MaterialScope.textEdgeButton3() =
182186
// [START android_wear_tile_getstarted_textedgebutton3]
183187
textEdgeButton(
184188
colors =
185-
androidx.wear.protolayout.material3.ButtonColors(
189+
ButtonColors(
186190
// the materialScope makes colorScheme available
187191
containerColor = colorScheme.secondary,
188192
iconColor = colorScheme.secondaryDim,

0 commit comments

Comments
 (0)