diff --git a/sample/src/main/java/com/google/android/horologist/materialcomponents/SampleCardScreen.kt b/sample/src/main/java/com/google/android/horologist/materialcomponents/SampleCardScreen.kt index de55f3dbdd..8eb9c4fb82 100644 --- a/sample/src/main/java/com/google/android/horologist/materialcomponents/SampleCardScreen.kt +++ b/sample/src/main/java/com/google/android/horologist/materialcomponents/SampleCardScreen.kt @@ -22,16 +22,16 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text +import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices import com.google.android.horologist.compose.layout.ScalingLazyColumn import com.google.android.horologist.compose.layout.ScalingLazyColumnState import com.google.android.horologist.compose.layout.rememberColumnState import com.google.android.horologist.compose.material.Card -@Preview +@WearPreviewDevices @Composable fun SampleCardScreenPreview() { val state = rememberColumnState() @@ -47,6 +47,16 @@ internal fun SampleCardScreen( modifier = modifier, columnState = columnState, ) { + item { + Card( + onClick = { println("Click") }, + onLongClick = { println("LongClick") }, + onDoubleClick = { println("DoubleClick") }, + enabled = false, + ) { + Text("Hello\nCard") + } + } item { Card( onClick = { println("Click") }, @@ -54,7 +64,7 @@ internal fun SampleCardScreen( onDoubleClick = { println("DoubleClick") }, modifier = Modifier.background(Color.Cyan), ) { - Text("Hello, Card") + Text("Hello\nCard") } } item { @@ -65,7 +75,7 @@ internal fun SampleCardScreen( modifier = Modifier.background(Color.Cyan), shape = MaterialTheme.shapes.medium, ) { - Text("Hello, Card") + Text("Hello\nCard") } } item { @@ -75,7 +85,7 @@ internal fun SampleCardScreen( onDoubleClick = { println("DoubleClick") }, backgroundPainter = painterResource(id = android.R.drawable.ic_dialog_alert), ) { - Text("Hello, Card") + Text("Hello\nCard") } } item { @@ -85,7 +95,7 @@ internal fun SampleCardScreen( onDoubleClick = { println("DoubleClick") }, contentPadding = PaddingValues(24.dp), ) { - Text("Hello, Card") + Text("Hello\nCard") } } item { @@ -95,7 +105,7 @@ internal fun SampleCardScreen( onDoubleClick = { println("DoubleClick") }, contentColor = MaterialTheme.colors.primaryVariant, ) { - Text("Hello, Card") + Text("Hello\nCard") } } item { @@ -105,7 +115,7 @@ internal fun SampleCardScreen( onDoubleClick = { println("DoubleClick") }, enabled = false, ) { - Text("Hello, Card") + Text("Hello\nCard") } } } diff --git a/sample/src/main/java/com/google/android/horologist/sample/MenuScreen.kt b/sample/src/main/java/com/google/android/horologist/sample/MenuScreen.kt index 3f0dc24e9d..258bc35e93 100644 --- a/sample/src/main/java/com/google/android/horologist/sample/MenuScreen.kt +++ b/sample/src/main/java/com/google/android/horologist/sample/MenuScreen.kt @@ -125,6 +125,13 @@ fun MenuScreen( onClick = { navigateToRoute(Screen.MaterialButtonsScreen.route) }, ) } + item { + Chip( + label = stringResource(id = R.string.sample_material_cards), + modifier = modifier.fillMaxWidth(), + onClick = { navigateToRoute(Screen.MaterialCardsScreen.route) }, + ) + } item { Chip( label = stringResource(id = R.string.sample_material_chips), diff --git a/sample/src/main/java/com/google/android/horologist/sample/SampleWearApp.kt b/sample/src/main/java/com/google/android/horologist/sample/SampleWearApp.kt index 314976cfbf..887b506a39 100644 --- a/sample/src/main/java/com/google/android/horologist/sample/SampleWearApp.kt +++ b/sample/src/main/java/com/google/android/horologist/sample/SampleWearApp.kt @@ -40,6 +40,7 @@ import com.google.android.horologist.compose.layout.ScreenScaffold import com.google.android.horologist.compose.layout.rememberColumnState import com.google.android.horologist.materialcomponents.SampleAlertDialog import com.google.android.horologist.materialcomponents.SampleButtonScreen +import com.google.android.horologist.materialcomponents.SampleCardScreen import com.google.android.horologist.materialcomponents.SampleChipIconWithProgressScreen import com.google.android.horologist.materialcomponents.SampleChipScreen import com.google.android.horologist.materialcomponents.SampleCompactChipScreen @@ -218,6 +219,15 @@ fun SampleWearApp() { SampleButtonScreen(columnState = columnState) } } + composable( + route = Screen.MaterialCardsScreen.route, + ) { + val columnState = rememberColumnState() + + ScreenScaffold(scrollState = columnState) { + SampleCardScreen(columnState = columnState) + } + } composable( route = Screen.MaterialChipsScreen.route, ) { diff --git a/sample/src/main/java/com/google/android/horologist/sample/Screen.kt b/sample/src/main/java/com/google/android/horologist/sample/Screen.kt index 3afaa4f75e..43c2a7781e 100644 --- a/sample/src/main/java/com/google/android/horologist/sample/Screen.kt +++ b/sample/src/main/java/com/google/android/horologist/sample/Screen.kt @@ -35,6 +35,7 @@ sealed class Screen( object MaterialAlertDialog : Screen("materialAlertDialog") object MaterialButtonsScreen : Screen("materialButtonsScreen") + object MaterialCardsScreen : Screen("materialCardsScreen") object MaterialChipsScreen : Screen("materialChipsScreen") object MaterialChipIconWithProgressScreen : Screen("materialChipIconWithProgressScreen") object MaterialCompactChipsScreen : Screen("materialCompactChips") diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml index dab3ff05f8..c8f28fa2fe 100644 --- a/sample/src/main/res/values/strings.xml +++ b/sample/src/main/res/values/strings.xml @@ -84,4 +84,5 @@ Pager Screen Pager Screen Vertical Pager Screen + Material Cards Screen