From b9cbd14ffec7158825682a808303cf1b77f3a116 Mon Sep 17 00:00:00 2001 From: MrYoranimo Date: Thu, 4 Jan 2024 22:39:23 +0100 Subject: [PATCH] Xiaomi: fix logic for ability to select widget workout type --- .../gadgetbridge/devices/xiaomi/XiaomiWidgetManager.java | 6 ++---- app/src/main/proto/xiaomi.proto | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiWidgetManager.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiWidgetManager.java index 9e9db972d..63649618f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiWidgetManager.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiWidgetManager.java @@ -104,8 +104,7 @@ public class XiaomiWidgetManager implements WidgetManager { type ); - // FIXME are there others? - if (widgetPart.getId() == 2321) { + if (widgetPart.getFunction() == 16) { if (StringUtils.isBlank(newPart.getName())) { newPart.setName(GBApplication.getContext().getString(R.string.menuitem_workout)); } @@ -170,8 +169,7 @@ public class XiaomiWidgetManager implements WidgetManager { newPart.setName(rawPart1.getTitle()); } - // FIXME are there others? - if (widgetPart.getId() == 2321) { + if (widgetPart.getFunction() == 16) { if (StringUtils.isBlank(newPart.getName())) { newPart.setName(GBApplication.getContext().getString(R.string.menuitem_workout)); } diff --git a/app/src/main/proto/xiaomi.proto b/app/src/main/proto/xiaomi.proto index afd434a48..baad7813f 100644 --- a/app/src/main/proto/xiaomi.proto +++ b/app/src/main/proto/xiaomi.proto @@ -253,11 +253,11 @@ message WidgetParts { message WidgetPart { optional uint32 type = 1; // 1 for small 1x1, 2 for wide 2x1, 3 for tall 1x2 - optional uint32 app = 2; // matches command type + optional uint32 function = 2; // matches command type optional uint32 id = 3; // they all seem unique optional string title = 4; // not set on create optional uint32 subType = 5; // usually 0 if no subtype - optional string unknown6 = 6; // "" on get + optional string appId = 6; // "" on get optional string unknown7 = 7; // "" on get }