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 02fd69588..1d9723aca 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 @@ -2409,11 +2409,18 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { } LOG.info("enabled items" + enabledList); - byte[] command = new byte[keyIdMap.size() * 4 + 1]; + byte[] command = new byte[(keyIdMap.size() + 1) * 4 + 1]; command[0] = 0x1e; // it seem that we first have to put all ENABLED items into the array, oder does matter + int pos = 1; int index = 0; + + command[pos++] = (byte) index++; + command[pos++] = 0x00; + command[pos++] = menuType; + command[pos++] = 0x12; + for (String key : enabledList) { Integer id = keyIdMap.get(key); if (id != null) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitband5/AmazfitBand5Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitband5/AmazfitBand5Support.java index 5badad8cf..a584847ee 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitband5/AmazfitBand5Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitband5/AmazfitBand5Support.java @@ -49,12 +49,40 @@ public class AmazfitBand5Support extends MiBand5Support { keyIdMap.put("workout", 0x03); keyIdMap.put("more", 0x07); keyIdMap.put("stress", 0x1c); - keyIdMap.put("cycles", 0x1d); + keyIdMap.put("period", 0x1d); setDisplayItemsNew(builder, false, R.array.pref_amazfitband5_display_items_default, keyIdMap); return this; } + @Override + protected AmazfitBand5Support setShortcuts(TransactionBuilder builder) { + Map keyIdMap = new LinkedHashMap<>(); + keyIdMap.put("notifications", 0x06); + keyIdMap.put("weather", 0x04); + keyIdMap.put("music", 0x0b); + keyIdMap.put("timer", 0x0d); + keyIdMap.put("alarm", 0x09); + keyIdMap.put("findphone", 0x0e); + keyIdMap.put("worldclock", 0x1a); + keyIdMap.put("status", 0x01); + keyIdMap.put("pai", 0x19); + keyIdMap.put("hr", 0x02); + keyIdMap.put("spo2", 0x24); + keyIdMap.put("stress", 0x1c); + keyIdMap.put("eventreminder", 0x15); + keyIdMap.put("dnd", 0x08); + keyIdMap.put("stopwatch", 0x0c); + keyIdMap.put("workout", 0x03); + keyIdMap.put("mutephone", 0x0f); + keyIdMap.put("period", 0x1d); + keyIdMap.put("takephoto", 0x0a); + keyIdMap.put("alexa", 0x39); + setDisplayItemsNew(builder, true, R.array.pref_amazfitband5_shortcuts_default, keyIdMap); + + return this; + } + @Override public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { return new AmazfitBand5FWHelper(uri, context); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java index a1bc831f9..af31c9969 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/miband5/MiBand5Support.java @@ -48,12 +48,38 @@ public class MiBand5Support extends MiBand4Support { keyIdMap.put("workout", 0x03); keyIdMap.put("more", 0x07); keyIdMap.put("stress", 0x1c); - keyIdMap.put("cycles", 0x1d); + keyIdMap.put("period", 0x1d); setDisplayItemsNew(builder, false, R.array.pref_miband5_display_items_default, keyIdMap); return this; } + @Override + protected MiBand5Support setShortcuts(TransactionBuilder builder) { + Map keyIdMap = new LinkedHashMap<>(); + keyIdMap.put("notifications", 0x06); + keyIdMap.put("weather", 0x04); + keyIdMap.put("music", 0x0b); + keyIdMap.put("timer", 0x0d); + keyIdMap.put("alarm", 0x09); + keyIdMap.put("findphone", 0x0e); + keyIdMap.put("worldclock", 0x1a); + keyIdMap.put("status", 0x01); + keyIdMap.put("pai", 0x19); + keyIdMap.put("hr", 0x02); + keyIdMap.put("stress", 0x1c); + keyIdMap.put("eventreminder", 0x15); + keyIdMap.put("dnd", 0x08); + keyIdMap.put("stopwatch", 0x0c); + keyIdMap.put("workout", 0x03); + keyIdMap.put("mutephone", 0x0f); + keyIdMap.put("period", 0x1d); + keyIdMap.put("takephoto", 0x0a); + setDisplayItemsNew(builder, true, R.array.pref_miband5_shortcuts_default, keyIdMap); + + return this; + } + @Override public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException { return new MiBand5FWHelper(uri, context); diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index e7d8ddf0b..880fbda92 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -355,6 +355,54 @@ @string/p_menuitem_cycles + + @string/menuitem_weather + @string/menuitem_notifications + @string/menuitem_music + @string/menuitem_timer + @string/menuitem_alarm + @string/menuitem_findphone + @string/menuitem_worldclock + @string/menuitem_status + @string/menuitem_pai + @string/menuitem_hr + @string/menuitem_stress + @string/menuitem_eventreminder + @string/menuitem_dnd + @string/menuitem_stopwatch + @string/menuitem_workout + @string/menuitem_mutephone + @string/menuitem_cycles + @string/menuitem_takephoto + + + + @string/p_menuitem_notifications + @string/p_menuitem_weather + @string/p_menuitem_music + @string/p_menuitem_timer + @string/p_menuitem_alarm + @string/p_menuitem_findphone + @string/p_menuitem_worldclock + @string/p_menuitem_status + @string/p_menuitem_pai + @string/p_menuitem_hr + @string/p_menuitem_stress + @string/p_menuitem_eventreminder + @string/p_menuitem_dnd + @string/p_menuitem_stopwatch + @string/p_menuitem_workout + @string/p_menuitem_mutephone + @string/p_menuitem_cycles + @string/p_menuitem_takephoto + + + + @string/p_menuitem_notifications + @string/p_menuitem_weather + @string/p_menuitem_music + + @string/menuitem_status @string/menuitem_pai @@ -400,6 +448,58 @@ @string/p_menuitem_cycles + + @string/menuitem_weather + @string/menuitem_notifications + @string/menuitem_music + @string/menuitem_timer + @string/menuitem_alarm + @string/menuitem_findphone + @string/menuitem_worldclock + @string/menuitem_status + @string/menuitem_pai + @string/menuitem_hr + @string/menuitem_spo2 + @string/menuitem_stress + @string/menuitem_eventreminder + @string/menuitem_dnd + @string/menuitem_stopwatch + @string/menuitem_workout + @string/menuitem_mutephone + @string/menuitem_cycles + @string/menuitem_takephoto + @string/menuitem_alexa + + + + @string/p_menuitem_notifications + @string/p_menuitem_weather + @string/p_menuitem_music + @string/p_menuitem_timer + @string/p_menuitem_alarm + @string/p_menuitem_findphone + @string/p_menuitem_worldclock + @string/p_menuitem_status + @string/p_menuitem_pai + @string/p_menuitem_hr + @string/p_menuitem_spo2 + @string/p_menuitem_stress + @string/p_menuitem_eventreminder + @string/p_menuitem_dnd + @string/p_menuitem_stopwatch + @string/p_menuitem_workout + @string/p_menuitem_mutephone + @string/p_menuitem_cycles + @string/p_menuitem_takephoto + @string/p_menuitem_alexa + + + + @string/p_menuitem_notifications + @string/p_menuitem_weather + @string/p_menuitem_music + + @string/menuitem_status @string/menuitem_activity @@ -592,11 +692,6 @@ - @string/p_menuitem_status - @string/p_menuitem_alipay - @string/p_menuitem_nfc - @string/p_menuitem_pai - @string/p_menuitem_hr @string/p_menuitem_music @string/p_menuitem_weather diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 78c2d0af1..00eb21be1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -818,7 +818,7 @@ Activity Weather Breathing - Cycles + Period Alarm Timer Compass @@ -836,6 +836,12 @@ Workout Unknown World Clock + Find Phone + Mute Phone + Take a photo + Alexa + DND + Stopwatch Minutes: Hours: Seconds: diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml index eefaf6191..923579587 100644 --- a/app/src/main/res/values/values.xml +++ b/app/src/main/res/values/values.xml @@ -36,10 +36,16 @@ spo2 pai stress - cycles + period eventreminder workout worldclock + findphone + dnd + stopwatch + mutephone + takephoto + alexa off on diff --git a/app/src/main/res/xml/devicesettings_amazfitband5.xml b/app/src/main/res/xml/devicesettings_amazfitband5.xml index 25efda5ad..2ce45964a 100644 --- a/app/src/main/res/xml/devicesettings_amazfitband5.xml +++ b/app/src/main/res/xml/devicesettings_amazfitband5.xml @@ -9,6 +9,15 @@ android:key="display_items" android:summary="@string/mi2_prefs_display_items_summary" android:title="@string/mi2_prefs_display_items" /> + +