diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java index 629a34bc2..8c6435ed7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/ConfigActivity.java @@ -353,10 +353,10 @@ public class ConfigActivity extends AbstractGBActivity { final int currentIndex = i; String configName = buttonConfig.getString(i); TextView buttonTextView = new TextView(ConfigActivity.this); + buttonTextView.setTextColor(Color.WHITE); + buttonTextView.setTextSize(20); try { ConfigPayload payload = ConfigPayload.valueOf(configName); - buttonTextView.setTextColor(Color.WHITE); - buttonTextView.setTextSize(20); buttonTextView.setText("Button " + (i + 1) + ": " + payload.getDescription()); } catch (IllegalArgumentException e) { buttonTextView.setText("Button " + (i + 1) + ": Unknown"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java index 7f5588f4d..37e5caca7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java @@ -78,7 +78,7 @@ public class FossilWatchAdapter extends WatchAdapter { super.onConfigurationsGet(configs); JSONArray buttons = new JSONArray(); - for (ConfigPayload payload : configs) buttons.put(payload.toString()); + for (ConfigPayload payload : configs) buttons.put(String.valueOf(payload)); String json = buttons.toString(); getDeviceSupport().getDevice().addDeviceInfo(new GenericItem(ITEM_BUTTONS, json)); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/buttons/ButtonConfigurationGetRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/buttons/ButtonConfigurationGetRequest.java index ecb58222a..fecbefaa9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/buttons/ButtonConfigurationGetRequest.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil/buttons/ButtonConfigurationGetRequest.java @@ -29,9 +29,14 @@ public class ButtonConfigurationGetRequest extends FileGetRequest { ConfigPayload[] configs = new ConfigPayload[count]; + buffer.position(16); for(int i = 0; i < count; i++){ - byte buttonIndex = (byte) (buffer.get(16 + i * 7) >> 4); - short appId = buffer.getShort(19 + i * 7); + int buttonIndex = buffer.get() >> 4; + int entryCount = buffer.get(); + buffer.get(); + short appId = buffer.getShort(); + + buffer.position(buffer.position() + entryCount * 5 - 3); try { configs[buttonIndex - 1] = ConfigPayload.fromId(appId);