From 6d02e8c488ad850ba62aab76f37e091c730686df Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 7 Feb 2021 16:23:45 +0100 Subject: [PATCH] Amazfit GTS/GTR2 (all variants): Try to fix missing menu items This was reported in #2189 for the GTS 2 Mini, but let's assume it is the same problem for all variants. --- .../amazfitgtr2/AmazfitGTR2Coordinator.java | 2 +- .../amazfitgtr2/AmazfitGTR2eCoordinator.java | 2 +- .../amazfitgts2/AmazfitGTS2Coordinator.java | 2 +- .../amazfitgts2/AmazfitGTS2eCoordinator.java | 2 +- .../service/devices/huami/HuamiSupport.java | 9 ++- app/src/main/res/values/arrays.xml | 66 +++++++++++++++++++ .../res/xml/devicesettings_amazfitgtsgtr2.xml | 21 ++++++ 7 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/xml/devicesettings_amazfitgtsgtr2.xml 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 8c6fc2ea4..8170d82ef 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 @@ -88,7 +88,7 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator { } public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtsgtr, + R.xml.devicesettings_amazfitgtsgtr2, 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/amazfitgtr2/AmazfitGTR2eCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgtr2/AmazfitGTR2eCoordinator.java index 1e6fa91bc..c9b8fa4eb 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 @@ -89,7 +89,7 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtsgtr, + R.xml.devicesettings_amazfitgtsgtr2, 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/amazfitgts2/AmazfitGTS2Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2Coordinator.java index 4a8df757c..b1a76acd8 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 @@ -88,7 +88,7 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator { } public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtsgtr, + R.xml.devicesettings_amazfitgtsgtr2, 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/amazfitgts2/AmazfitGTS2eCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts2/AmazfitGTS2eCoordinator.java index 2b93886a3..7194e72bb 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 @@ -89,7 +89,7 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtsgtr, + R.xml.devicesettings_amazfitgtsgtr2, 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/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java index 666027dfa..643cd79a4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java @@ -1999,7 +1999,14 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { @Override public void onTestNewFunction() { - + try { + boolean test = false; + TransactionBuilder builder = performInitialized("test pattern"); + byte[] testpattern = new byte[] {0x20,0x00, (byte) 0x4b,0x64,0x00, (byte) 0x8d,0x01,0x73,0x00,0x38,0x01,0x64,0x00,0x64,0x00,0x64,0x00,0x67,0x00,0x64,0x00,0x37,0x01,0x7c,0x00,0x64,0x00,0x64,0x00,0x67,0x00,0x64,0x00,0x67,0x00,0x64,0x00,0x37,0x01,0x64,0x00,0x64,0x00,0x64,0x00, (byte) 0xe5,0x02}; + //byte[] testpattern = new byte[] {0x20,0x00, (byte) 0x00, 0,0,0,0}; + writeToChunked(builder,2, testpattern); + builder.queue(getQueue()); + } catch (Exception ignored) {} } @Override diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index ed1a3effd..33bd6910f 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -667,6 +667,72 @@ @string/p_menuitem_settings + + @string/menuitem_status + @string/menuitem_hr + @string/menuitem_pai + @string/menuitem_workout + @string/menuitem_activity + @string/menuitem_sleep + @string/menuitem_weather + @string/menuitem_alarm + @string/menuitem_stopwatch + @string/menuitem_timer + @string/menuitem_breathing + @string/menuitem_stress + @string/menuitem_spo2 + @string/menuitem_worldclock + @string/menuitem_pomodoro + @string/menuitem_music + @string/menuitem_cycles + @string/menuitem_settings + @string/menuitem_more + + + + @string/p_menuitem_status + @string/p_menuitem_hr + @string/p_menuitem_pai + @string/p_menuitem_workout + @string/p_menuitem_activity + @string/p_menuitem_sleep + @string/p_menuitem_weather + @string/p_menuitem_alarm + @string/p_menuitem_stopwatch + @string/p_menuitem_timer + @string/p_menuitem_breathing + @string/p_menuitem_stress + @string/p_menuitem_spo2 + @string/p_menuitem_worldclock + @string/p_menuitem_pomodoro + @string/p_menuitem_music + @string/p_menuitem_cycles + @string/p_menuitem_settings + @string/p_menuitem_more + + + + @string/p_menuitem_status + @string/p_menuitem_hr + @string/p_menuitem_pai + @string/p_menuitem_workout + @string/p_menuitem_activity + @string/p_menuitem_sleep + @string/p_menuitem_weather + @string/p_menuitem_alarm + @string/p_menuitem_stopwatch + @string/p_menuitem_timer + @string/p_menuitem_breathing + @string/p_menuitem_stress + @string/p_menuitem_spo2 + @string/p_menuitem_worldclock + @string/p_menuitem_pomodoro + @string/p_menuitem_music + @string/p_menuitem_cycles + @string/p_menuitem_settings + @string/p_menuitem_more + + @string/menuitem_status @string/menuitem_pai diff --git a/app/src/main/res/xml/devicesettings_amazfitgtsgtr2.xml b/app/src/main/res/xml/devicesettings_amazfitgtsgtr2.xml new file mode 100644 index 000000000..388f8d039 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_amazfitgtsgtr2.xml @@ -0,0 +1,21 @@ + + + + +