Show "None" for media auto-download when all options are disabled.

Co-authored-by: jeffrey-signal <jeffrey@signal.org>

Closes signalapp/Signal-Android#14678
This commit is contained in:
thomasboom
2026-03-21 15:04:15 +00:00
committed by jeffrey-signal
parent 8c4f614d17
commit 330a5aece2
3 changed files with 14 additions and 4 deletions

View File

@@ -219,16 +219,21 @@ object Rows {
labels: Array<String>,
values: Array<String>,
selection: Array<String>,
noSelectionLabel: String,
onSelectionChanged: (Array<String>) -> Unit
) {
var displayDialog by remember { mutableStateOf(false) }
TextRow(
text = text,
label = selection.joinToString(", ") {
val index = values.indexOf(it)
if (index == -1) error("not found: $it in ${values.joinToString(", ")}")
labels[index]
label = if (selection.isNotEmpty()) {
selection.joinToString(", ") {
val index = values.indexOf(it)
if (index == -1) error("not found: $it in ${values.joinToString(", ")}")
labels[index]
}
} else {
noSelectionLabel
},
onClick = {
displayDialog = true
@@ -698,6 +703,7 @@ private fun MultiSelectRowPreview() {
labels = arrayOf("A", "B", "C"),
values = arrayOf("a", "b", "c"),
selection = selectedValues,
noSelectionLabel = "None",
onSelectionChanged = {
selectedValues = it
}

View File

@@ -21,4 +21,5 @@
<!-- StorageUtil -->
<!-- Format string for displaying a storage path as volume/filename -->
<string name="StorageUtil__s_s">%1$s/%2$s</string>
</resources>