mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Address review
This commit is contained in:
+2
-2
@@ -259,7 +259,7 @@ private fun MaxSelectionsStepper(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.Minus(),
|
||||
contentDescription = null,
|
||||
contentDescription = stringResource(id = CommonStrings.a11y_create_poll_votes_allowed_decrease),
|
||||
modifier = Modifier
|
||||
.clickable(enabled = current > 1) { onDecrement() }
|
||||
.size(32.dp)
|
||||
@@ -277,7 +277,7 @@ private fun MaxSelectionsStepper(
|
||||
)
|
||||
Icon(
|
||||
imageVector = CompoundIcons.Plus(),
|
||||
contentDescription = null,
|
||||
contentDescription = stringResource(id = CommonStrings.a11y_create_poll_votes_allowed_increase),
|
||||
modifier = Modifier
|
||||
.clickable(enabled = current < max) { onIncrement() }
|
||||
.size(32.dp)
|
||||
|
||||
+1
-9
@@ -46,8 +46,6 @@ data class PollFormState(
|
||||
* Create a copy of the [PollFormState] with a new blank answer added.
|
||||
*
|
||||
* If the maximum number of answers has already been reached an answer is not added.
|
||||
*
|
||||
* Also clamps [maxSelections] to the new answer count to keep state consistent.
|
||||
*/
|
||||
fun withNewAnswer(): PollFormState {
|
||||
if (!canAddAnswer) {
|
||||
@@ -55,8 +53,7 @@ data class PollFormState(
|
||||
}
|
||||
|
||||
val newAnswers = (answers + "").toImmutableList()
|
||||
val clampedMaxSelections = maxSelections.coerceIn(1, newAnswers.size)
|
||||
return copy(answers = newAnswers, maxSelections = clampedMaxSelections)
|
||||
return copy(answers = newAnswers)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,11 +100,6 @@ data class PollFormState(
|
||||
*/
|
||||
val canDeleteAnswer get() = answers.size > MIN_ANSWERS
|
||||
|
||||
/**
|
||||
* The effective max selections, clamped to the number of answers.
|
||||
*/
|
||||
val effectiveMaxSelections get() = maxSelections.coerceIn(1, answers.size)
|
||||
|
||||
/**
|
||||
* Whether the form is currently valid.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user