mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 19:18:37 +00:00
Make the whole row tappable.
This commit is contained in:
@@ -161,7 +161,21 @@ private fun PollOption(
|
|||||||
val progressValue by animateFloatAsState(targetValue = progress, animationSpec = tween(durationMillis = 250))
|
val progressValue by animateFloatAsState(targetValue = progress, animationSpec = tween(durationMillis = 250))
|
||||||
|
|
||||||
Row(
|
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) {
|
if (!hasEnded) {
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
@@ -176,21 +190,7 @@ private fun PollOption(
|
|||||||
) { voteState ->
|
) { voteState ->
|
||||||
when (voteState) {
|
when (voteState) {
|
||||||
VoteState.PENDING_ADD -> {
|
VoteState.PENDING_ADD -> {
|
||||||
Box(
|
Box(modifier = Modifier) {
|
||||||
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
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
modifier = Modifier.padding(top = 4.dp, end = 8.dp).size(24.dp),
|
modifier = Modifier.padding(top = 4.dp, end = 8.dp).size(24.dp),
|
||||||
strokeWidth = 1.5.dp,
|
strokeWidth = 1.5.dp,
|
||||||
@@ -206,19 +206,7 @@ private fun PollOption(
|
|||||||
}
|
}
|
||||||
VoteState.PENDING_REMOVE -> {
|
VoteState.PENDING_REMOVE -> {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
modifier = Modifier.padding(top = 4.dp, end = 8.dp).size(24.dp)
|
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
|
|
||||||
),
|
|
||||||
strokeWidth = 1.5.dp,
|
strokeWidth = 1.5.dp,
|
||||||
color = pollColors.checkbox
|
color = pollColors.checkbox
|
||||||
)
|
)
|
||||||
@@ -228,12 +216,7 @@ private fun PollOption(
|
|||||||
VoteState.NONE -> {
|
VoteState.NONE -> {
|
||||||
RoundCheckbox(
|
RoundCheckbox(
|
||||||
checked = voteState == VoteState.ADDED,
|
checked = voteState == VoteState.ADDED,
|
||||||
onCheckedChange = { checked ->
|
onCheckedChange = {},
|
||||||
if (VibrateUtil.isHapticFeedbackEnabled(context)) {
|
|
||||||
haptics.performHapticFeedback(if (checked) HapticFeedbackType.ToggleOn else HapticFeedbackType.ToggleOff)
|
|
||||||
}
|
|
||||||
onToggleVote(option, checked)
|
|
||||||
},
|
|
||||||
modifier = Modifier.padding(top = 4.dp, end = 8.dp).height(24.dp),
|
modifier = Modifier.padding(top = 4.dp, end = 8.dp).height(24.dp),
|
||||||
outlineColor = pollColors.checkbox,
|
outlineColor = pollColors.checkbox,
|
||||||
checkedColor = pollColors.checkboxBackground
|
checkedColor = pollColors.checkboxBackground
|
||||||
|
|||||||
Reference in New Issue
Block a user