From a85246c279fbb4e1508a4cbdeb5e62d3b796664d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Wed, 30 Aug 2023 23:58:58 +0100 Subject: [PATCH] Use GBDeviceCandidate#getName on all coordinators --- .../gadgetbridge/devices/banglejs/BangleJSCoordinator.java | 2 +- .../devices/casio/gb6900/CasioGB6900DeviceCoordinator.java | 2 +- .../devices/casio/gbx100/CasioGBX100DeviceCoordinator.java | 2 +- .../casio/gwb5600/CasioGMWB5000DeviceCoordinator.java | 2 +- .../casio/gwb5600/CasioGWB5600DeviceCoordinator.java | 2 +- .../gadgetbridge/devices/domyos/DomyosT540Coordinator.java | 2 +- .../devices/fitpro/FitProDeviceCoordinator.java | 4 +--- .../gadgetbridge/devices/hplus/EXRIZUK8Coordinator.java | 2 +- .../gadgetbridge/devices/hplus/HPlusCoordinator.java | 2 +- .../gadgetbridge/devices/hplus/MakibesF68Coordinator.java | 2 +- .../gadgetbridge/devices/hplus/Q8Coordinator.java | 2 +- .../gadgetbridge/devices/hplus/SG2Coordinator.java | 2 +- .../devices/huami/amazfitband5/AmazfitBand5Coordinator.java | 4 +--- .../devices/huami/amazfitband7/AmazfitBand7Coordinator.java | 4 +--- .../devices/huami/amazfitbip/AmazfitBipCoordinator.java | 4 +--- .../devices/huami/amazfitbip/AmazfitBipLiteCoordinator.java | 4 +--- .../huami/amazfitbip3pro/AmazfitBip3ProCoordinator.java | 4 +--- .../devices/huami/amazfitbip5/AmazfitBip5Coordinator.java | 4 +--- .../devices/huami/amazfitbips/AmazfitBipSCoordinator.java | 4 +--- .../huami/amazfitbips/AmazfitBipSLiteCoordinator.java | 4 +--- .../devices/huami/amazfitbipu/AmazfitBipUCoordinator.java | 4 +--- .../huami/amazfitbipupro/AmazfitBipUProCoordinator.java | 4 +--- .../amazfitcheetahpro/AmazfitCheetahProCoordinator.java | 4 +--- .../amazfitcheetahround/AmazfitCheetahRoundCoordinator.java | 4 +--- .../AmazfitCheetahSquareCoordinator.java | 4 +--- .../devices/huami/amazfitcor/AmazfitCorCoordinator.java | 4 +--- .../devices/huami/amazfitcor2/AmazfitCor2Coordinator.java | 4 +--- .../huami/amazfitfalcon/AmazfitFalconCoordinator.java | 4 +--- .../devices/huami/amazfitgtr/AmazfitGTRCoordinator.java | 4 +--- .../devices/huami/amazfitgtr/AmazfitGTRLiteCoordinator.java | 4 +--- .../devices/huami/amazfitgtr2/AmazfitGTR2Coordinator.java | 4 +--- .../devices/huami/amazfitgtr2/AmazfitGTR2eCoordinator.java | 4 +--- .../devices/huami/amazfitgtr3/AmazfitGTR3Coordinator.java | 4 +--- .../huami/amazfitgtr3pro/AmazfitGTR3ProCoordinator.java | 4 +--- .../devices/huami/amazfitgtr4/AmazfitGTR4Coordinator.java | 4 +--- .../huami/amazfitgtrmini/AmazfitGTRMiniCoordinator.java | 4 +--- .../devices/huami/amazfitgts/AmazfitGTSCoordinator.java | 4 +--- .../devices/huami/amazfitgts2/AmazfitGTS2Coordinator.java | 4 +--- .../huami/amazfitgts2/AmazfitGTS2MiniCoordinator.java | 4 +--- .../devices/huami/amazfitgts2/AmazfitGTS2eCoordinator.java | 4 +--- .../devices/huami/amazfitgts3/AmazfitGTS3Coordinator.java | 4 +--- .../devices/huami/amazfitgts4/AmazfitGTS4Coordinator.java | 4 +--- .../huami/amazfitgts4mini/AmazfitGTS4MiniCoordinator.java | 4 +--- .../devices/huami/amazfitneo/AmazfitNeoCoordinator.java | 4 +--- .../devices/huami/amazfitpop/AmazfitPopCoordinator.java | 4 +--- .../huami/amazfitpoppro/AmazfitPopProCoordinator.java | 4 +--- .../devices/huami/amazfittrex/AmazfitTRexCoordinator.java | 4 +--- .../devices/huami/amazfittrex2/AmazfitTRex2Coordinator.java | 4 +--- .../huami/amazfittrexpro/AmazfitTRexProCoordinator.java | 4 +--- .../huami/amazfittrexultra/AmazfitTRexUltraCoordinator.java | 4 +--- .../huami/amazfitvergel/AmazfitVergeLCoordinator.java | 3 +-- .../devices/huami/amazfitx/AmazfitXCoordinator.java | 4 +--- .../devices/huami/miband2/MiBand2Coordinator.java | 4 +--- .../devices/huami/miband2/MiBand2HRXCoordinator.java | 6 ++---- .../devices/huami/miband3/MiBand3Coordinator.java | 4 +--- .../devices/huami/miband4/MiBand4Coordinator.java | 4 +--- .../devices/huami/miband5/MiBand5Coordinator.java | 4 +--- .../devices/huami/miband6/MiBand6Coordinator.java | 4 +--- .../devices/huami/miband7/MiBand7Coordinator.java | 4 +--- .../gadgetbridge/devices/huami/zeppe/ZeppECoordinator.java | 4 +--- .../gadgetbridge/devices/itag/ITagCoordinator.java | 2 +- .../gadgetbridge/devices/jyou/BFH16DeviceCoordinator.java | 2 +- .../devices/jyou/TeclastH30/TeclastH30Coordinator.java | 2 +- .../gadgetbridge/devices/jyou/y5/Y5Coordinator.java | 2 +- .../gadgetbridge/devices/liveview/LiveviewCoordinator.java | 2 +- .../devices/makibeshr3/MakibesHR3Coordinator.java | 2 +- .../gadgetbridge/devices/miband/MiBandCoordinator.java | 2 +- .../devices/mijia_lywsd02/MijiaLywsd02Coordinator.java | 2 +- .../devices/miscale2/MiScale2DeviceCoordinator.java | 4 +--- .../gadgetbridge/devices/no1f1/No1F1Coordinator.java | 2 +- .../gadgetbridge/devices/nut/NutCoordinator.java | 2 +- .../gadgetbridge/devices/pebble/PebbleCoordinator.java | 2 +- .../devices/pinetime/PineTimeJFCoordinator.java | 2 +- .../gadgetbridge/devices/roidmi/Roidmi1Coordinator.java | 5 +---- .../gadgetbridge/devices/roidmi/Roidmi3Coordinator.java | 5 +---- .../gadgetbridge/devices/smaq2oss/SMAQ2OSSCoordinator.java | 4 +--- .../gadgetbridge/devices/soflow/SoFlowCoordinator.java | 2 +- .../devices/sonyswr12/SonySWR12DeviceCoordinator.java | 2 +- .../devices/supercars/SuperCarsCoordinator.java | 4 +--- .../gadgetbridge/devices/tlw64/TLW64Coordinator.java | 2 +- .../devices/vibratissimo/VibratissimoCoordinator.java | 2 +- .../gadgetbridge/devices/waspos/WaspOSCoordinator.java | 2 +- .../withingssteelhr/WithingsSteelHRDeviceCoordinator.java | 2 +- .../gadgetbridge/devices/xwatch/XWatchCoordinator.java | 2 +- .../gadgetbridge/devices/zetime/ZeTimeCoordinator.java | 2 +- 85 files changed, 86 insertions(+), 195 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java index 704ac1c25..cc5b8e291 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/banglejs/BangleJSCoordinator.java @@ -72,7 +72,7 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); /* Filter by Espruino devices to avoid getting the device chooser full of spam devices. */ if (name != null && ( diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gb6900/CasioGB6900DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gb6900/CasioGB6900DeviceCoordinator.java index cf3e9b67c..e16e256dc 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gb6900/CasioGB6900DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gb6900/CasioGB6900DeviceCoordinator.java @@ -47,7 +47,7 @@ public class CasioGB6900DeviceCoordinator extends CasioDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.startsWith("CASIO") && (name.contains("6900B") || name.contains("5600B") || name.contains("STB-1000"))) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gbx100/CasioGBX100DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gbx100/CasioGBX100DeviceCoordinator.java index 208b2edd8..c6464fca9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gbx100/CasioGBX100DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gbx100/CasioGBX100DeviceCoordinator.java @@ -51,7 +51,7 @@ public class CasioGBX100DeviceCoordinator extends CasioDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.startsWith("CASIO") && (name.endsWith("GBX-100") || name.endsWith("GBD-200") || name.endsWith("GBD-100") || diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGMWB5000DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGMWB5000DeviceCoordinator.java index 46b5bb0ed..2fa3f1270 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGMWB5000DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGMWB5000DeviceCoordinator.java @@ -30,7 +30,7 @@ public class CasioGMWB5000DeviceCoordinator extends CasioGWB5600DeviceCoordinato @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.equals("CASIO GMW-B5000")) { return DeviceType.CASIOGMWB5000; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGWB5600DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGWB5600DeviceCoordinator.java index 69f1c94e3..41a32ea9b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGWB5600DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/casio/gwb5600/CasioGWB5600DeviceCoordinator.java @@ -49,7 +49,7 @@ public class CasioGWB5600DeviceCoordinator extends CasioDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.equals("CASIO GW-B5600")) { return DeviceType.CASIOGWB5600; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/domyos/DomyosT540Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/domyos/DomyosT540Coordinator.java index 20eb5ef2b..c560a7247 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/domyos/DomyosT540Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/domyos/DomyosT540Coordinator.java @@ -42,7 +42,7 @@ public class DomyosT540Coordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("Domyos-TC-9610")) { return DeviceType.DOMYOS_T540; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java index cbd24fd50..a34f07757 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java @@ -18,7 +18,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.fitpro; import android.app.Activity; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; import android.os.ParcelUuid; @@ -63,8 +62,7 @@ public class FitProDeviceCoordinator extends AbstractBLEDeviceCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && ( name.startsWith("M6") || diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/EXRIZUK8Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/EXRIZUK8Coordinator.java index 9e1fda2e8..1653a10c8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/EXRIZUK8Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/EXRIZUK8Coordinator.java @@ -33,7 +33,7 @@ public class EXRIZUK8Coordinator extends HPlusCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if(name != null && name.startsWith("iRun ")){ return DeviceType.EXRIZUK8; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/HPlusCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/HPlusCoordinator.java index 4debc7e31..d0695a965 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/HPlusCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/HPlusCoordinator.java @@ -75,7 +75,7 @@ public class HPlusCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("HPLUS")) { return DeviceType.HPLUS; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/MakibesF68Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/MakibesF68Coordinator.java index 0256316d1..514232d2a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/MakibesF68Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/MakibesF68Coordinator.java @@ -33,7 +33,7 @@ public class MakibesF68Coordinator extends HPlusCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if(name != null && name.startsWith("SPORT") && !name.startsWith("SPORTAGE")){ return DeviceType.MAKIBESF68; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/Q8Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/Q8Coordinator.java index 4a59e0b0f..d7b31fffb 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/Q8Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/Q8Coordinator.java @@ -33,7 +33,7 @@ public class Q8Coordinator extends HPlusCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if(name != null && name.startsWith("Q8")){ return DeviceType.Q8; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/SG2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/SG2Coordinator.java index 9a7a16d2f..e2168950f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/SG2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/hplus/SG2Coordinator.java @@ -31,7 +31,7 @@ public class SG2Coordinator extends HPlusCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("SG2")) { HPlusCoordinator.setNotificationLinesNumber(candidate.getDevice().getAddress(), 9); HPlusCoordinator.setUnicodeSupport(candidate.getDevice().getAddress(), true); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java index 4e6a1f949..a8cdedd51 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband5/AmazfitBand5Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband5; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -48,8 +47,7 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.AMAZFIT_BAND5_NAME)) { return DeviceType.AMAZFITBAND5; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband7/AmazfitBand7Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband7/AmazfitBand7Coordinator.java index 164ab16a2..a922f08c3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband7/AmazfitBand7Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitband7/AmazfitBand7Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitband7; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitBand7Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_BAND7_NAME)) { return DeviceType.AMAZFITBAND7; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java index a919f49e7..a8aef5a97 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitBipCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Bip Watch"))) { return DeviceType.AMAZFITBIP; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipLiteCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipLiteCoordinator.java index 33f6d22be..4635aca22 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipLiteCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip/AmazfitBipLiteCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -46,8 +45,7 @@ public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit Bip Lite")) { return DeviceType.AMAZFITBIP_LITE; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip3pro/AmazfitBip3ProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip3pro/AmazfitBip3ProCoordinator.java index 7646fa6ec..a32181cb1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip3pro/AmazfitBip3ProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip3pro/AmazfitBip3ProCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip3pro; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -46,8 +45,7 @@ public class AmazfitBip3ProCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit Bip 3 Pro")) { return DeviceType.AMAZFITBIP3PRO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip5/AmazfitBip5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip5/AmazfitBip5Coordinator.java index 65df33386..ab2800108 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip5/AmazfitBip5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbip5/AmazfitBip5Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip5; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -52,8 +51,7 @@ public class AmazfitBip5Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_BIP5_NAME)) { return DeviceType.AMAZFITBIP5; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSCoordinator.java index 65d01bb06..2e5d0f90d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbips; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitBipSCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Bip S"))) { return DeviceType.AMAZFITBIPS; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSLiteCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSLiteCoordinator.java index 73294d379..86094f1aa 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSLiteCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbips/AmazfitBipSLiteCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbips; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -44,8 +43,7 @@ public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Bip S Lite"))) { return DeviceType.AMAZFITBIPS_LITE; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java index 2ae2b550e..73f137630 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipu/AmazfitBipUCoordinator.java @@ -18,7 +18,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipu; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -48,8 +47,7 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Bip U"))) { return DeviceType.AMAZFITBIPU; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java index 6fd7fb59d..e0b969998 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitbipupro/AmazfitBipUProCoordinator.java @@ -18,7 +18,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipupro; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -48,8 +47,7 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Bip U Pro"))) { return DeviceType.AMAZFITBIPUPRO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahpro/AmazfitCheetahProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahpro/AmazfitCheetahProCoordinator.java index 5dc8ff009..97b2915d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahpro/AmazfitCheetahProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahpro/AmazfitCheetahProCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahpro; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitCheetahProCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_CHEETAH_PRO_NAME)) { return DeviceType.AMAZFITCHEETAHPRO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahround/AmazfitCheetahRoundCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahround/AmazfitCheetahRoundCoordinator.java index 3ea31603a..f20bf3326 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahround/AmazfitCheetahRoundCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahround/AmazfitCheetahRoundCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahround; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -52,8 +51,7 @@ public class AmazfitCheetahRoundCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_CHEETAH_ROUND_NAME)) { return DeviceType.AMAZFITCHEETAHROUND; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahsquare/AmazfitCheetahSquareCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahsquare/AmazfitCheetahSquareCoordinator.java index ec56a4b6b..ef31373dd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahsquare/AmazfitCheetahSquareCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcheetahsquare/AmazfitCheetahSquareCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcheetahsquare; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -52,8 +51,7 @@ public class AmazfitCheetahSquareCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_CHEETAH_SQUARE_NAME)) { return DeviceType.AMAZFITCHEETAHSQUARE; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java index 3eea6885e..1edbea44d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor/AmazfitCorCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitCorCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Band") || name.equalsIgnoreCase("Amazfit Cor"))) { return DeviceType.AMAZFITCOR; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor2/AmazfitCor2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor2/AmazfitCor2Coordinator.java index 7ac4d58ee..bfcc72431 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor2/AmazfitCor2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitcor2/AmazfitCor2Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitCor2Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Band 2") || name.equalsIgnoreCase("Amazfit Cor 2"))) { return DeviceType.AMAZFITCOR2; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitfalcon/AmazfitFalconCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitfalcon/AmazfitFalconCoordinator.java index 1a2514609..f3b7df700 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitfalcon/AmazfitFalconCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitfalcon/AmazfitFalconCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitfalcon; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -52,8 +51,7 @@ public class AmazfitFalconCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_FALCON_NAME)) { return DeviceType.AMAZFITFALCON; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java index fb555ca20..fd0bfbdb3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTR")) { return DeviceType.AMAZFITGTR; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRLiteCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRLiteCoordinator.java index 371283a40..eb716fd21 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRLiteCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr/AmazfitGTRLiteCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTR L")) { return DeviceType.AMAZFITGTR_LITE; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2Coordinator.java index 7ecdd833d..9e2b2be1c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTR 2")) { return DeviceType.AMAZFITGTR2; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2eCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2eCoordinator.java index 9522bba7f..1f40504ec 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2eCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2eCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTR 2e")) { return DeviceType.AMAZFITGTR2E; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3/AmazfitGTR3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3/AmazfitGTR3Coordinator.java index e891d69af..5e6e0f4bf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3/AmazfitGTR3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3/AmazfitGTR3Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitGTR3Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTR3_NAME) && !name.contains("Pro")) { return DeviceType.AMAZFITGTR3; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3pro/AmazfitGTR3ProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3pro/AmazfitGTR3ProCoordinator.java index 110f6ddb4..9e5509105 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3pro/AmazfitGTR3ProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr3pro/AmazfitGTR3ProCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitGTR3ProCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTR3_PRO_NAME)) { return DeviceType.AMAZFITGTR3PRO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr4/AmazfitGTR4Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr4/AmazfitGTR4Coordinator.java index 54229fcff..884320f56 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr4/AmazfitGTR4Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr4/AmazfitGTR4Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr4; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitGTR4Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTR4_NAME)) { return DeviceType.AMAZFITGTR4; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtrmini/AmazfitGTRMiniCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtrmini/AmazfitGTRMiniCoordinator.java index 2d6aa9dc3..1b71ddd23 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtrmini/AmazfitGTRMiniCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtrmini/AmazfitGTRMiniCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtrmini; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTRMiniCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTR_MINI_NAME)) { return DeviceType.AMAZFITGTRMINI; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java index e3227b8a0..450cdc1cf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -46,8 +45,7 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTS")) { return DeviceType.AMAZFITGTS; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2Coordinator.java index 9bcf7cafa..ed01d1e5d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTS 2")) { return DeviceType.AMAZFITGTS2; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2MiniCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2MiniCoordinator.java index d107a2c05..7087d6e57 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2MiniCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2MiniCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -46,8 +45,7 @@ public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTS2 mini")) { return DeviceType.AMAZFITGTS2_MINI; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2eCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2eCoordinator.java index 38419feb6..054af3452 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2eCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2eCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit GTS 2e")) { return DeviceType.AMAZFITGTS2E; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts3/AmazfitGTS3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts3/AmazfitGTS3Coordinator.java index 15835d3ec..089e00ce1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts3/AmazfitGTS3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts3/AmazfitGTS3Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts3; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitGTS3Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTS3_NAME)) { return DeviceType.AMAZFITGTS3; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4/AmazfitGTS4Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4/AmazfitGTS4Coordinator.java index 991aad384..2246b4b0a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4/AmazfitGTS4Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4/AmazfitGTS4Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitGTS4Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTS4_NAME) && !name.contains("Mini")) { return DeviceType.AMAZFITGTS4; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4mini/AmazfitGTS4MiniCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4mini/AmazfitGTS4MiniCoordinator.java index 989e8e24c..6d95a7b2f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4mini/AmazfitGTS4MiniCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts4mini/AmazfitGTS4MiniCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitGTS4MiniCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_GTS4_MINI_NAME)) { return DeviceType.AMAZFITGTS4MINI; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitneo/AmazfitNeoCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitneo/AmazfitNeoCoordinator.java index 7eadb9d86..864a82bee 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitneo/AmazfitNeoCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitneo/AmazfitNeoCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitneo; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -51,8 +50,7 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.AMAZFIT_NEO_NAME)) { return DeviceType.AMAZFITNEO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpop/AmazfitPopCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpop/AmazfitPopCoordinator.java index 4b4423dda..1c42edb65 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpop/AmazfitPopCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpop/AmazfitPopCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitpop; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -44,8 +43,7 @@ public class AmazfitPopCoordinator extends AmazfitBipUCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Pop"))) { return DeviceType.AMAZFITPOP; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpoppro/AmazfitPopProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpoppro/AmazfitPopProCoordinator.java index 90fde1516..ff7330a83 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpoppro/AmazfitPopProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitpoppro/AmazfitPopProCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitpoppro; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -44,8 +43,7 @@ public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase("Amazfit Pop Pro"))) { return DeviceType.AMAZFITPOPPRO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex/AmazfitTRexCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex/AmazfitTRexCoordinator.java index b6f7afd6e..5fb39f357 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex/AmazfitTRexCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex/AmazfitTRexCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit T-Rex")) { return DeviceType.AMAZFITTREX; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex2/AmazfitTRex2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex2/AmazfitTRex2Coordinator.java index e946a84c8..a5b1fac43 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex2/AmazfitTRex2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrex2/AmazfitTRex2Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class AmazfitTRex2Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_TREX_2_NAME)) { return DeviceType.AMAZFITTREX2; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexpro/AmazfitTRexProCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexpro/AmazfitTRexProCoordinator.java index a04fd121e..46d723826 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexpro/AmazfitTRexProCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexpro/AmazfitTRexProCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrexpro; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit T-Rex Pro")) { return DeviceType.AMAZFITTREXPRO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexultra/AmazfitTRexUltraCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexultra/AmazfitTRexUltraCoordinator.java index b5d41642d..bac7dba09 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexultra/AmazfitTRexUltraCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfittrexultra/AmazfitTRexUltraCoordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrexultra; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -52,8 +51,7 @@ public class AmazfitTRexUltraCoordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.AMAZFIT_TREX_ULTRA)) { return DeviceType.AMAZFITTREXULTRA; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitvergel/AmazfitVergeLCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitvergel/AmazfitVergeLCoordinator.java index f678417c3..789dd3c78 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitvergel/AmazfitVergeLCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitvergel/AmazfitVergeLCoordinator.java @@ -46,8 +46,7 @@ public class AmazfitVergeLCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Amazfit Verge L")) { return DeviceType.AMAZFITVERGEL; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitx/AmazfitXCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitx/AmazfitXCoordinator.java index de2be71e3..c4f3ba7fe 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitx/AmazfitXCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitx/AmazfitXCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitx; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -49,8 +48,7 @@ public class AmazfitXCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.AMAZFIT_X)) { return DeviceType.AMAZFITX; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java index 7f472cf3e..45f4e1234 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -51,8 +50,7 @@ public class MiBand2Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.MI_BAND2_NAME)) { return DeviceType.MIBAND2; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2HRXCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2HRXCoordinator.java index 79473bf33..d29591f66 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2HRXCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband2/MiBand2HRXCoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband2; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -27,7 +26,7 @@ import org.slf4j.LoggerFactory; import androidx.annotation.NonNull; import java.util.EnumSet; - +z import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; @@ -51,8 +50,7 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (HuamiConst.MI_BAND2_NAME_HRX.equalsIgnoreCase(name) || "Mi Band 2i".equalsIgnoreCase(name)) { return DeviceType.MIBAND2_HRX; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java index ff529d39e..141a98ccd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband3/MiBand3Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -53,8 +52,7 @@ public class MiBand3Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && (name.equalsIgnoreCase(HuamiConst.MI_BAND3_NAME) || name.equalsIgnoreCase(HuamiConst.MI_BAND3_NAME_2))) { return DeviceType.MIBAND3; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java index 9d9587def..2edd470f7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband4/MiBand4Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband4; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -53,8 +52,7 @@ public class MiBand4Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.MI_BAND4_NAME)) { return DeviceType.MIBAND4; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java index b5944651c..3fdb388ad 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband5/MiBand5Coordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -52,8 +51,7 @@ public class MiBand5Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.MI_BAND5_NAME)) { return DeviceType.MIBAND5; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java index 9f9518dfb..b3b30e09d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband6/MiBand6Coordinator.java @@ -1,6 +1,5 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband6; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -30,8 +29,7 @@ public class MiBand6Coordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase(HuamiConst.MI_BAND6_NAME)) { return DeviceType.MIBAND6; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband7/MiBand7Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband7/MiBand7Coordinator.java index acc30ecde..ed259cf0e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband7/MiBand7Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/miband7/MiBand7Coordinator.java @@ -16,7 +16,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.miband7; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -41,8 +40,7 @@ public class MiBand7Coordinator extends Huami2021Coordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.startsWith(HuamiConst.XIAOMI_SMART_BAND7_NAME)) { return DeviceType.MIBAND7; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppECoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppECoordinator.java index 00668fbfa..e38a55f12 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppECoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppe/ZeppECoordinator.java @@ -17,7 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.huami.zeppe; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class ZeppECoordinator extends HuamiCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("Zepp E")) { return DeviceType.ZEPP_E; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/itag/ITagCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/itag/ITagCoordinator.java index 88a732e97..665cb9949 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/itag/ITagCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/itag/ITagCoordinator.java @@ -45,7 +45,7 @@ public class ITagCoordinator extends AbstractBLEDeviceCoordinator { @Override @NonNull public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.toLowerCase().startsWith("itag")) { // All four: iTAG, iTag, ITAG and ITag exist return DeviceType.ITAG; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/BFH16DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/BFH16DeviceCoordinator.java index 16e44ce04..03b301697 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/BFH16DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/BFH16DeviceCoordinator.java @@ -76,7 +76,7 @@ public class BFH16DeviceCoordinator extends AbstractBLEDeviceCoordinator @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.startsWith("BFH-16")) { return DeviceType.BFH16; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/TeclastH30/TeclastH30Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/TeclastH30/TeclastH30Coordinator.java index fa2023f93..cb48ce8f0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/TeclastH30/TeclastH30Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/TeclastH30/TeclastH30Coordinator.java @@ -70,7 +70,7 @@ public class TeclastH30Coordinator extends AbstractBLEDeviceCoordinator { return DeviceType.TECLASTH30; } - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.startsWith("TECLAST_H30") || name.startsWith("TECLAST_H10")) { return DeviceType.TECLASTH30; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/y5/Y5Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/y5/Y5Coordinator.java index 30edcb4c4..17b35c77b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/y5/Y5Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/jyou/y5/Y5Coordinator.java @@ -51,7 +51,7 @@ public class Y5Coordinator extends AbstractBLEDeviceCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null) { if (name.contains("Y5")) { return DeviceType.Y5; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/liveview/LiveviewCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/liveview/LiveviewCoordinator.java index c166d3053..af5d0bfd1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/liveview/LiveviewCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/liveview/LiveviewCoordinator.java @@ -39,7 +39,7 @@ public class LiveviewCoordinator extends AbstractBLClassicDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("LiveView")) { return DeviceType.LIVEVIEW; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java index a36371e1c..d93f06ec7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java @@ -153,7 +153,7 @@ public class MakibesHR3Coordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); List deviceNames = new ArrayList(){{ add("Y808"); // Chinese version diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java index 913bdb719..4e22c4a4b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandCoordinator.java @@ -88,7 +88,7 @@ public class MiBandCoordinator extends AbstractBLEDeviceCoordinator { try { BluetoothDevice device = candidate.getDevice(); if (isHealthWearable(device)) { - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.toUpperCase().startsWith(MiBandConst.MI_GENERAL_NAME_PREFIX.toUpperCase())) { return DeviceType.MIBAND; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd02/MijiaLywsd02Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd02/MijiaLywsd02Coordinator.java index 067c4ee06..f88839529 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd02/MijiaLywsd02Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/mijia_lywsd02/MijiaLywsd02Coordinator.java @@ -39,7 +39,7 @@ public class MijiaLywsd02Coordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.equals("LYWSD02")) { return DeviceType.MIJIA_LYWSD02; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miscale2/MiScale2DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miscale2/MiScale2DeviceCoordinator.java index 80d861312..0c1e6eb97 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miscale2/MiScale2DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miscale2/MiScale2DeviceCoordinator.java @@ -19,7 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.miscale2; import android.annotation.TargetApi; import android.app.Activity; -import android.bluetooth.BluetoothDevice; import android.bluetooth.le.ScanFilter; import android.content.Context; import android.net.Uri; @@ -60,8 +59,7 @@ public class MiScale2DeviceCoordinator extends AbstractBLEDeviceCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.equalsIgnoreCase("MIBCS")) { return DeviceType.MISCALE2; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/no1f1/No1F1Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/no1f1/No1F1Coordinator.java index 8e70cd5e3..7edd64da4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/no1f1/No1F1Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/no1f1/No1F1Coordinator.java @@ -58,7 +58,7 @@ public class No1F1Coordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && (name.startsWith("X-RUN") || name.startsWith("MH30"))) { return DeviceType.NO1F1; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/nut/NutCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/nut/NutCoordinator.java index c7020fc47..3c94f1500 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/nut/NutCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/nut/NutCoordinator.java @@ -46,7 +46,7 @@ public class NutCoordinator extends AbstractBLEDeviceCoordinator { @Override @NonNull public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.toLowerCase().startsWith("nut")) { return DeviceType.NUTMINI; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java index 602134487..d5cd32c2c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java @@ -57,7 +57,7 @@ public class PebbleCoordinator extends AbstractBLClassicDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("Pebble")) { return DeviceType.PEBBLE; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pinetime/PineTimeJFCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pinetime/PineTimeJFCoordinator.java index 8f8a3a8df..0a1f94578 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pinetime/PineTimeJFCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pinetime/PineTimeJFCoordinator.java @@ -40,7 +40,7 @@ public class PineTimeJFCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && (name.startsWith("Pinetime-JF") || name.startsWith("InfiniTime"))) { return DeviceType.PINETIME_JF; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi1Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi1Coordinator.java index 1dc411e38..e973e532c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi1Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi1Coordinator.java @@ -17,8 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.roidmi; -import android.bluetooth.BluetoothDevice; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,8 +33,7 @@ public class Roidmi1Coordinator extends RoidmiCoordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name != null && name.contains("睿米车载蓝牙播放器")) { return DeviceType.ROIDMI; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi3Coordinator.java index b88f0eb8b..d08f60004 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/roidmi/Roidmi3Coordinator.java @@ -17,8 +17,6 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.devices.roidmi; -import android.bluetooth.BluetoothDevice; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,8 +33,7 @@ public class Roidmi3Coordinator extends RoidmiCoordinator { @Override public DeviceType getSupportedType(final GBDeviceCandidate candidate) { try { - final BluetoothDevice device = candidate.getDevice(); - final String name = device.getName(); + final String name = candidate.getName(); if (name == null) { return DeviceType.UNKNOWN; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSCoordinator.java index 652cd4da3..ab229d5ab 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/smaq2oss/SMAQ2OSSCoordinator.java @@ -1,7 +1,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.smaq2oss; import android.app.Activity; -import android.bluetooth.BluetoothDevice; import android.bluetooth.le.ScanFilter; import android.content.Context; import android.net.Uri; @@ -47,8 +46,7 @@ public class SMAQ2OSSCoordinator extends AbstractBLEDeviceCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); // TODO still match for "SMA-Q2-OSS" because of backward firmware compatibility - remove eventually if (name != null && (name.startsWith("SMAQ2-") || name.equalsIgnoreCase("SMA-Q2-OSS"))) { return DeviceType.SMAQ2OSS; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/soflow/SoFlowCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/soflow/SoFlowCoordinator.java index b37073a89..e000db107 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/soflow/SoFlowCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/soflow/SoFlowCoordinator.java @@ -39,7 +39,7 @@ public class SoFlowCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("SoFlow-")) { return DeviceType.SOFLOW_SO6; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sonyswr12/SonySWR12DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sonyswr12/SonySWR12DeviceCoordinator.java index d329c834e..9e645f32d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sonyswr12/SonySWR12DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sonyswr12/SonySWR12DeviceCoordinator.java @@ -49,7 +49,7 @@ public class SonySWR12DeviceCoordinator extends AbstractBLEDeviceCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && !name.isEmpty() && name.toLowerCase().contains("swr12")) return getDeviceType(); } catch (Exception exc){} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/supercars/SuperCarsCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/supercars/SuperCarsCoordinator.java index 4c78a28ae..ea6c1a587 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/supercars/SuperCarsCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/supercars/SuperCarsCoordinator.java @@ -1,7 +1,6 @@ package nodomain.freeyourgadget.gadgetbridge.devices.supercars; import android.app.Activity; -import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; @@ -36,8 +35,7 @@ public class SuperCarsCoordinator extends AbstractDeviceCoordinator { @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { try { - BluetoothDevice device = candidate.getDevice(); - String name = device.getName(); + String name = candidate.getName(); if (name != null && name.startsWith("QCAR-")) { return DeviceType.SUPER_CARS; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java index e4cee4298..3ffc5a77e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java @@ -48,7 +48,7 @@ public class TLW64Coordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("Smart Bee")) { return DeviceType.TLW64; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/vibratissimo/VibratissimoCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/vibratissimo/VibratissimoCoordinator.java index c184cfcb3..ab4a7b184 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/vibratissimo/VibratissimoCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/vibratissimo/VibratissimoCoordinator.java @@ -42,7 +42,7 @@ public class VibratissimoCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("Vibratissimo")) { return DeviceType.VIBRATISSIMO; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/waspos/WaspOSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/waspos/WaspOSCoordinator.java index c5096743c..849692b08 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/waspos/WaspOSCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/waspos/WaspOSCoordinator.java @@ -69,7 +69,7 @@ public class WaspOSCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); /* Filter by Espruino devices to avoid getting the device chooser full of spam devices. */ if (name != null && ( diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/withingssteelhr/WithingsSteelHRDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/withingssteelhr/WithingsSteelHRDeviceCoordinator.java index 8bfa9489f..91b021037 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/withingssteelhr/WithingsSteelHRDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/withingssteelhr/WithingsSteelHRDeviceCoordinator.java @@ -53,7 +53,7 @@ public class WithingsSteelHRDeviceCoordinator extends AbstractDeviceCoordinator @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && (name.toLowerCase(Locale.ROOT).startsWith("steel") || name.toLowerCase(Locale.ROOT).startsWith("activite"))) { return DeviceType.WITHINGS_STEEL_HR; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xwatch/XWatchCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xwatch/XWatchCoordinator.java index 7b6692b79..7a49b8130 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xwatch/XWatchCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xwatch/XWatchCoordinator.java @@ -40,7 +40,7 @@ public class XWatchCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("XWatch")) { return DeviceType.XWATCH; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeCoordinator.java index d447f4f54..9e1cf87e0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeCoordinator.java @@ -56,7 +56,7 @@ public class ZeTimeCoordinator extends AbstractBLEDeviceCoordinator { @NonNull @Override public DeviceType getSupportedType(GBDeviceCandidate candidate) { - String name = candidate.getDevice().getName(); + String name = candidate.getName(); if (name != null && name.startsWith("ZeTime")) { return DeviceType.ZETIME; }