From e3f15f7bd89f333517ea682cf5dd8d63337f08d5 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Thu, 29 Sep 2016 22:56:16 +0200 Subject: [PATCH] Sort devices lexicographically --- .../gadgetbridge/devices/DeviceManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceManager.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceManager.java index f9856d4f..2482d65a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceManager.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/DeviceManager.java @@ -11,8 +11,11 @@ import android.support.v4.content.LocalBroadcastManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.text.Collator; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Set; @@ -133,6 +136,12 @@ public class DeviceManager { } } + Collections.sort(deviceList, new Comparator() { + @Override + public int compare(GBDevice lhs, GBDevice rhs) { + return Collator.getInstance().compare(lhs.getName(), rhs.getName()); + } + }); notifyDevicesChanged(); }