Make the whole row tappable.

This commit is contained in:
Michelle Tang
2025-11-14 12:16:42 -05:00
parent d5aba6cd9a
commit 1abd09754f

View File

@@ -161,7 +161,21 @@ private fun PollOption(
val progressValue by animateFloatAsState(targetValue = progress, animationSpec = tween(durationMillis = 250))
Row(
modifier = Modifier.padding(start = 12.dp, end = 16.dp, top = 8.dp, bottom = 8.dp)
modifier = Modifier
.padding(start = 12.dp, end = 16.dp, top = 8.dp, bottom = 8.dp)
.clickable(
onClick = {
val added = option.voteState == VoteState.PENDING_ADD || option.voteState == VoteState.ADDED
if (VibrateUtil.isHapticFeedbackEnabled(context)) {
haptics.performHapticFeedback(if (added) HapticFeedbackType.ToggleOff else HapticFeedbackType.ToggleOn)
}
onToggleVote(option, !added)
},
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClickLabel = stringResource(R.string.SignalCheckbox_accessibility_on_click_label),
enabled = true
)
) {
if (!hasEnded) {
AnimatedContent(
@@ -176,21 +190,7 @@ private fun PollOption(
) { voteState ->
when (voteState) {
VoteState.PENDING_ADD -> {
Box(
modifier = Modifier
.clickable(
onClick = {
if (VibrateUtil.isHapticFeedbackEnabled(context)) {
haptics.performHapticFeedback(HapticFeedbackType.ToggleOff)
}
onToggleVote(option, false)
},
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClickLabel = stringResource(R.string.SignalCheckbox_accessibility_on_click_label),
enabled = true
)
) {
Box(modifier = Modifier) {
CircularProgressIndicator(
modifier = Modifier.padding(top = 4.dp, end = 8.dp).size(24.dp),
strokeWidth = 1.5.dp,
@@ -206,19 +206,7 @@ private fun PollOption(
}
VoteState.PENDING_REMOVE -> {
CircularProgressIndicator(
modifier = Modifier.padding(top = 4.dp, end = 8.dp).size(24.dp)
.clickable(
onClick = {
if (VibrateUtil.isHapticFeedbackEnabled(context)) {
haptics.performHapticFeedback(HapticFeedbackType.ToggleOn)
}
onToggleVote(option, true)
},
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClickLabel = stringResource(R.string.SignalCheckbox_accessibility_on_click_label),
enabled = true
),
modifier = Modifier.padding(top = 4.dp, end = 8.dp).size(24.dp),
strokeWidth = 1.5.dp,
color = pollColors.checkbox
)
@@ -228,12 +216,7 @@ private fun PollOption(
VoteState.NONE -> {
RoundCheckbox(
checked = voteState == VoteState.ADDED,
onCheckedChange = { checked ->
if (VibrateUtil.isHapticFeedbackEnabled(context)) {
haptics.performHapticFeedback(if (checked) HapticFeedbackType.ToggleOn else HapticFeedbackType.ToggleOff)
}
onToggleVote(option, checked)
},
onCheckedChange = {},
modifier = Modifier.padding(top = 4.dp, end = 8.dp).height(24.dp),
outlineColor = pollColors.checkbox,
checkedColor = pollColors.checkboxBackground