feat: sort device list while keeping None (Disabled) at the top of the list (#1309)

Signed-off-by: Matthew Bogner <matt@ibogner.net>
pull/1312/head
Matthew Bogner 2024-10-13 06:23:55 -05:00 zatwierdzone przez GitHub
rodzic 86dc8f2b1c
commit df7ce09fdb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -360,7 +360,11 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
if (devices == null) return
var hasShownOurDevice = false
devices.values.forEach { device ->
devices.values
// Display the device list in alphabetical order while keeping the "None (Disabled)"
// device (fullAddress == n) at the top
.sortedBy { dle -> if (dle.fullAddress == "n") "0" else dle.name }
.forEach { device ->
if (device.fullAddress == scanModel.selectedNotNull)
hasShownOurDevice = true
addDeviceButton(device, true)