mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
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:
committed by
jeffrey-signal
parent
8c4f614d17
commit
330a5aece2
@@ -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
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user