Refactor: Use plurals for unmatched devices count.

This commit is contained in:
darken
2025-10-07 12:43:33 +02:00
committed by Matthias Urhahn
parent 743f5aeb89
commit 0f74cb9b39
2 changed files with 7 additions and 9 deletions
@@ -21,19 +21,15 @@ class UnmatchedDevicesCardVH(parent: ViewGroup) :
item: Item,
payloads: List<Any>
) -> Unit = binding(payload = true) { item ->
val countText = when (item.count) {
1 -> context.getString(R.string.overview_unmatched_devices_count_single)
else -> context.getString(R.string.overview_unmatched_devices_count_plural, item.count)
}
unmatchedCount.text = countText
unmatchedCount.text = getQuantityString(R.plurals.overview_unmatched_devices_count, item.count, item.count)
val toggleText = if (item.isExpanded) {
context.getString(R.string.general_hide_action)
} else {
context.getString(R.string.general_show_action)
}
toggleAction.text = toggleText
toggleAction.setOnClickListener { item.onToggle() }
}
+4 -2
View File
@@ -161,8 +161,10 @@
<string name="overview_monitoring_active_label">Monitoring for devices</string>
<string name="overview_monitoring_active_description">Make sure your device is nearby and active.</string>
<string name="overview_unmatched_devices_label">Unmatched devices</string>
<string name="overview_unmatched_devices_count_single">1 device without matching profile</string>
<string name="overview_unmatched_devices_count_plural">%d devices without matching profile</string>
<plurals name="overview_unmatched_devices_count">
<item quantity="one">%d device without matching profile</item>
<item quantity="other">%d devices without matching profile</item>
</plurals>
<string name="permission_bluetooth_connect_label">Bluetooth connect</string>
<string name="permission_bluetooth_connect_description">This app requires the \"Bluetooth connect\" permission to interact with paired devices and initiate connections.</string>