From e03fd4357e4514ef572d65e86a75a615658ebac1 Mon Sep 17 00:00:00 2001 From: mamutcho Date: Wed, 20 Nov 2019 20:38:02 +0200 Subject: [PATCH] Add initial Watch X non-plus support --- .../lenovo/watchxplus/WatchXPlusDeviceCoordinator.java | 4 ++++ .../gadgetbridge/devices/watch9/Watch9DeviceCoordinator.java | 3 ++- app/src/main/res/xml/watchxplus_preferences.xml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java index 977ba302d..bff49a6d7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java @@ -79,6 +79,10 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator { return DeviceType.WATCHXPLUS; } else if (deviceName.equalsIgnoreCase("WATCH XPLUS")) { return DeviceType.WATCHXPLUS; + // add initial support for Watch X non-plus (forces Watch X to be recognized as Watch XPlus) + // Watch X non-plus have same MAC address as Watch 9 (starts with "1C:87:79") + } else if (deviceName.equalsIgnoreCase("WATCH X")) { + return DeviceType.WATCHXPLUS; } return DeviceType.UNKNOWN; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/watch9/Watch9DeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/watch9/Watch9DeviceCoordinator.java index 18b0a8844..08d8d1d04 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/watch9/Watch9DeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/watch9/Watch9DeviceCoordinator.java @@ -63,7 +63,8 @@ public class Watch9DeviceCoordinator extends AbstractDeviceCoordinator { String deviceName = candidate.getName().toUpperCase(); if (candidate.supportsService(Watch9Constants.UUID_SERVICE_WATCH9)) { return DeviceType.WATCH9; - } else if (macAddress.startsWith("1C:87:79")) { + // add support for Watch X non-plus (same MAC address) + } else if ((macAddress.startsWith("1C:87:79")) && (!deviceName.equalsIgnoreCase("WATCH X"))) { return DeviceType.WATCH9; } else if (deviceName.equals("WATCH 9")) { return DeviceType.WATCH9; diff --git a/app/src/main/res/xml/watchxplus_preferences.xml b/app/src/main/res/xml/watchxplus_preferences.xml index 68348e7d7..7be6108e9 100644 --- a/app/src/main/res/xml/watchxplus_preferences.xml +++ b/app/src/main/res/xml/watchxplus_preferences.xml @@ -39,7 +39,7 @@ android:key="pref_category_watchxplus_callhandling" android:title="@string/pref_header_wxp_notification_callhandling"> + android:title="@string/pref_header_wxp_notification_callhandling"/>