diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java index 9f3fd5c19..8c17cca77 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/DeviceCandidateAdapter.java @@ -18,6 +18,7 @@ package nodomain.freeyourgadget.gadgetbridge.adapter; import android.bluetooth.BluetoothDevice; import android.content.Context; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -25,6 +26,7 @@ import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; +import java.util.ArrayList; import java.util.List; import nodomain.freeyourgadget.gadgetbridge.GBApplication; @@ -65,27 +67,24 @@ public class DeviceCandidateAdapter extends ArrayAdapter { deviceAddressLabel.setText(device.getMacAddress()); deviceImageView.setImageResource(device.getDeviceType().getIcon()); - String status = ""; + final List statusLines = new ArrayList<>(); if (device.getDevice().getBondState() == BluetoothDevice.BOND_BONDED) { - status += getContext().getString(R.string.device_is_currently_bonded); + statusLines.add(getContext().getString(R.string.device_is_currently_bonded)); if (!GBApplication.getPrefs().getBoolean("ignore_bonded_devices", true)) { // This could be passed to the constructor instead deviceImageView.setImageResource(device.getDeviceType().getDisabledIcon()); } } if (!device.getDeviceType().isSupported()) { - status += " UNSUPPORTED"; + statusLines.add(getContext().getString(R.string.device_unsupported)); } DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) { - if (device.getDevice().getBondState() == BluetoothDevice.BOND_BONDED) { - status += "\n"; - } - status += getContext().getString(R.string.device_requires_key); + statusLines.add(getContext().getString(R.string.device_requires_key)); } - deviceStatus.setText(status); + deviceStatus.setText(TextUtils.join("\n", statusLines)); return view; } diff --git a/app/src/main/res/layout/activity_discovery.xml b/app/src/main/res/layout/activity_discovery.xml index 58d4cabdd..a9980b208 100644 --- a/app/src/main/res/layout/activity_discovery.xml +++ b/app/src/main/res/layout/activity_discovery.xml @@ -29,7 +29,7 @@ + android:text="@string/discovery_bluetooth_scan" /> + android:text="@string/discovery_bluetooth_le_scan" /> Device discovery Stop scanning Start discovery + Bluetooth scan: + Bluetooth LE scan: Connect new device %1$s (%2$s) Pair device @@ -1102,6 +1104,7 @@ Starting the background service failed becauseā€¦ ALREADY BONDED KEY REQUIRED + UNSUPPORTED Starting the background service failed because of an exception. Error: Check permission status Check and ask for missing permissions even when they might not be instantly needed. Disable this only if your devices actually doesn\'t support any of these features. Not granting a permission might cause issues!