From 94358e79b0f519413c13d8598279d55bfba8bc31 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 3 May 2020 20:14:29 +0200 Subject: [PATCH] Amazfit GTR/GTR Lite: enable setting menu items (untested) --- CHANGELOG.md | 1 + .../amazfitgtr/AmazfitGTRCoordinator.java | 2 +- .../amazfitgtr/AmazfitGTRLiteCoordinator.java | 2 +- .../amazfitgts/AmazfitGTSCoordinator.java | 2 +- .../amazfitgtr/AmazfitGTRLiteSupport.java | 33 ++++--------------- .../huami/amazfitgtr/AmazfitGTRSupport.java | 32 ++---------------- .../res/xml/devicesettings_amazfitgtr.xml | 11 ------- ...s.xml => devicesettings_amazfitgtsgtr.xml} | 0 8 files changed, 12 insertions(+), 71 deletions(-) delete mode 100644 app/src/main/res/xml/devicesettings_amazfitgtr.xml rename app/src/main/res/xml/{devicesettings_amazfitgts.xml => devicesettings_amazfitgtsgtr.xml} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e11e02f..c82681c7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Fossil Hybrid HR: Fix some issues with custon widgets * Fossil Hybrid HR: Allow setting alarm titles and descriptions * Amazfit GTS: Fix setting menu items with low MTU +* Amazfit GTR: Allow setting menu itdem like GTS #### Version 0.43.3 * Fossil Hybrid HR: Initial support for activity tracking (no sleep yet) 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 b4bfdcafe..e9f204724 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 @@ -88,7 +88,7 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator { } public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtr, + R.xml.devicesettings_amazfitgtsgtr, R.xml.devicesettings_wearlocation, R.xml.devicesettings_timeformat, R.xml.devicesettings_liftwrist_display, 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 bb7d6cb96..48f2fc873 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 @@ -89,7 +89,7 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtr, + R.xml.devicesettings_amazfitgtsgtr, R.xml.devicesettings_wearlocation, R.xml.devicesettings_timeformat, R.xml.devicesettings_liftwrist_display, 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 9c8704185..fa16757a2 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 @@ -88,7 +88,7 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgts, + R.xml.devicesettings_amazfitgtsgtr, R.xml.devicesettings_wearlocation, R.xml.devicesettings_timeformat, R.xml.devicesettings_liftwrist_display, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRLiteSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRLiteSupport.java index 9c31f772d..ec45c3d32 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRLiteSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRLiteSupport.java @@ -23,41 +23,20 @@ import java.io.IOException; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRLiteFWHelper; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; -import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; -import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew; +import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport; -public class AmazfitGTRLiteSupport extends AmazfitBipSupport { - - @Override - public byte getCryptFlags() { - return (byte) 0x80; - } - - @Override - protected byte getAuthFlags() { - return 0x00; - } - - @Override - public void onNotification(NotificationSpec notificationSpec) { - super.sendNotificationNew(notificationSpec, true); - } +public class AmazfitGTRLiteSupport extends AmazfitGTSSupport { @Override public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { return new AmazfitGTRLiteFWHelper(uri, context); } + // override to skip requesting GPS version @Override - public UpdateFirmwareOperationNew createUpdateFirmwareOperation(Uri uri) { - return new UpdateFirmwareOperationNew(uri, this); - } - - @Override - protected AmazfitGTRLiteSupport setDisplayItems(TransactionBuilder builder) { - // not supported yet - return this; + public void phase2Initialize(TransactionBuilder builder) { + super.phase2Initialize(builder); + setLanguage(builder); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java index 470c61f14..18d81bbde 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgtr/AmazfitGTRSupport.java @@ -23,41 +23,13 @@ import java.io.IOException; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRFWHelper; -import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; -import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; -import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; -import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew; +import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport; -public class AmazfitGTRSupport extends AmazfitBipSupport { - - @Override - public byte getCryptFlags() { - return (byte) 0x80; - } - - @Override - protected byte getAuthFlags() { - return 0x00; - } - - @Override - public void onNotification(NotificationSpec notificationSpec) { - super.sendNotificationNew(notificationSpec, true); - } +public class AmazfitGTRSupport extends AmazfitGTSSupport { @Override public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { return new AmazfitGTRFWHelper(uri, context); } - @Override - public UpdateFirmwareOperationNew createUpdateFirmwareOperation(Uri uri) { - return new UpdateFirmwareOperationNew(uri, this); - } - - @Override - protected AmazfitGTRSupport setDisplayItems(TransactionBuilder builder) { - // not supported yet - return this; - } } diff --git a/app/src/main/res/xml/devicesettings_amazfitgtr.xml b/app/src/main/res/xml/devicesettings_amazfitgtr.xml deleted file mode 100644 index c63cc0699..000000000 --- a/app/src/main/res/xml/devicesettings_amazfitgtr.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - diff --git a/app/src/main/res/xml/devicesettings_amazfitgts.xml b/app/src/main/res/xml/devicesettings_amazfitgtsgtr.xml similarity index 100% rename from app/src/main/res/xml/devicesettings_amazfitgts.xml rename to app/src/main/res/xml/devicesettings_amazfitgtsgtr.xml