Fixed
Status Update
Comments
jn...@google.com <jn...@google.com> #2
yeah this feels like an oversight. Looking at the core compose card I see that there is now an option for a Card with no onClick/enabled provided. I think the best way forward is to expose enabled on AppCard and TitleCard and pass them through to the underlying Card implementation.
mk...@google.com <mk...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit ee36f5382294f85cee9f20498f71e751b30aa0fc
Author: mkulaha <mkulaha@google.com>
Date: Wed Apr 13 21:19:22 2022
Add enabled parameter to AppCard and TitleCard
Bug: 228869805
Test: Manually checked
Relnote: "Add enabled parameter to AppCard and TitleCard"
Change-Id: Idc48d9088b2f285ba2ecf541ec126f3a79ba7496
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Card.kt
M wear/compose/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/api/public_plus_experimental_current.txt
https://android-review.googlesource.com/2064229
Branch: androidx-main
commit ee36f5382294f85cee9f20498f71e751b30aa0fc
Author: mkulaha <mkulaha@google.com>
Date: Wed Apr 13 21:19:22 2022
Add enabled parameter to AppCard and TitleCard
Bug: 228869805
Test: Manually checked
Relnote: "Add enabled parameter to AppCard and TitleCard"
Change-Id: Idc48d9088b2f285ba2ecf541ec126f3a79ba7496
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Card.kt
M wear/compose/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/api/public_plus_experimental_current.txt
mk...@google.com <mk...@google.com>
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit e3d0f4f6616e50bda19930ae0277094401052257
Author: mkulaha <mkulaha@google.com>
Date: Thu Apr 14 11:12:24 2022
Add more tests fort AppCard and TitleCard
Bug: 228869805
Test: wear.compose.material.CardTest
Relnote: "Add more tests fort AppCard and TitleCard"
Change-Id: I85391f610a7ff821796a10cf94045d0c009c2803
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/CardTest.kt
https://android-review.googlesource.com/2063833
Branch: androidx-main
commit e3d0f4f6616e50bda19930ae0277094401052257
Author: mkulaha <mkulaha@google.com>
Date: Thu Apr 14 11:12:24 2022
Add more tests fort AppCard and TitleCard
Bug: 228869805
Test: wear.compose.material.CardTest
Relnote: "Add more tests fort AppCard and TitleCard"
Change-Id: I85391f610a7ff821796a10cf94045d0c009c2803
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/CardTest.kt
Description
Version used: Alpha20
Close if intentional.
I'm using the same component in the list page, and then as one item in the detail page. AppCard requires an onClick, and doesn't allow setting enabled = false.
So I'll have to duplicate the whole AppCard to make it look the same but not clickable. It doesn't make sense for it to have a ripple and do nothing when clicked.
```
@Composable
public fun AppCard(
onClick: () -> Unit,
appName: @Composable () -> Unit,
time: @Composable () -> Unit,
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
appImage: @Composable (() -> Unit)? = null,
backgroundPainter: Painter = CardDefaults.cardBackgroundPainter(),
appColor: Color = MaterialTheme.colors.onSurfaceVariant,
timeColor: Color = MaterialTheme.colors.onSurfaceVariant,
titleColor: Color = MaterialTheme.colors.onSurface,
contentColor: Color = MaterialTheme.colors.onSurfaceVariant,
content: @Composable () -> Unit,
) {
Card(
onClick = onClick,
modifier = modifier,
backgroundPainter = backgroundPainter,
enabled = true,
```