mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-10 16:02:25 +01:00
Merge #75: show the alias the driver gave a paired Bluetooth device
This commit is contained in:
commit
a70dea7bd5
1 file changed
+2
-2
@@ -104,11 +104,11 @@ object WirelessLink {
|
|||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
fun pairedDevices(context: Context): List<BluetoothDevice> =
|
fun pairedDevices(context: Context): List<BluetoothDevice> =
|
||||||
context.getSystemService(BluetoothManager::class.java)?.adapter?.bondedDevices
|
context.getSystemService(BluetoothManager::class.java)?.adapter?.bondedDevices
|
||||||
?.sortedBy { it.name ?: it.address }
|
?.sortedBy { name(it) }
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
fun name(device: BluetoothDevice): String = device.name ?: device.address
|
fun name(device: BluetoothDevice): String = device.alias ?: device.name ?: device.address
|
||||||
|
|
||||||
fun start(context: Context, device: BluetoothDevice) {
|
fun start(context: Context, device: BluetoothDevice) {
|
||||||
stop(context)
|
stop(context)
|
||||||
|
|||||||
Reference in new issue
Block a user