Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 039013c2 authored by Jason Monk's avatar Jason Monk Committed by Gerrit Code Review
Browse files

Merge "Sort Bluetooth devices in quick settings by name"

parents 4b7b21ec a8f45e63
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public interface BluetoothController {
        void onBluetoothPairedDevicesChanged();
    }

    public static final class PairedDevice {
    public static final class PairedDevice implements Comparable<PairedDevice> {
        public static int STATE_DISCONNECTED = 0;
        public static int STATE_CONNECTING = 1;
        public static int STATE_CONNECTED = 2;
@@ -55,5 +55,9 @@ public interface BluetoothController {
            if (state == STATE_DISCONNECTING) return "STATE_DISCONNECTING";
            return "UNKNOWN";
        }

        public int compareTo(PairedDevice another) {
            return name.compareTo(another.name);
        }
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import android.os.Looper;
import android.os.Message;
import android.os.ParcelUuid;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Log;
import android.util.SparseArray;

@@ -55,6 +54,7 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Set;
import java.util.TreeSet;

public class BluetoothControllerImpl implements BluetoothController {
    private static final String TAG = "BluetoothController";
@@ -194,8 +194,8 @@ public class BluetoothControllerImpl implements BluetoothController {
    }

    @Override
    public ArraySet<PairedDevice> getPairedDevices() {
        final ArraySet<PairedDevice> rt = new ArraySet<>();
    public Set<PairedDevice> getPairedDevices() {
        final Set<PairedDevice> rt = new TreeSet<>();
        for (int i = 0; i < mDeviceInfo.size(); i++) {
            final BluetoothDevice device = mDeviceInfo.keyAt(i);
            final DeviceInfo info = mDeviceInfo.valueAt(i);