From c3a9cf858e40aa054c2302ae27bef4066baf223e Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Mon, 15 Jun 2020 16:45:39 +0800 Subject: [PATCH] Amazfit Bip S: Allow longer notification message --- .../gadgetbridge/service/devices/huami/HuamiSupport.java | 6 ++++-- .../devices/huami/amazfitbips/AmazfitBipSSupport.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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 576aa964d..99a30fc02 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 @@ -609,6 +609,9 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { This works on all Huami devices except Mi Band 2 */ protected void sendNotificationNew(NotificationSpec notificationSpec, boolean hasExtraHeader) { + sendNotificationNew(notificationSpec, hasExtraHeader, 230); + } + protected void sendNotificationNew(NotificationSpec notificationSpec, boolean hasExtraHeader, int maxLength) { if (notificationSpec.type == NotificationType.GENERIC_ALARM_CLOCK) { onAlarmClock(notificationSpec); return; @@ -621,7 +624,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { message += StringUtils.truncate(notificationSpec.subject, 128) + "\n\n"; } if (notificationSpec.body != null) { - message += StringUtils.truncate(notificationSpec.body, 128); + message += StringUtils.truncate(notificationSpec.body, 512); } try { @@ -639,7 +642,6 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { alertCategory = AlertCategory.Email; } - int maxLength = 230; if (characteristicChunked != null) { int prefixlength = 2; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSSupport.java index a824e5a26..9ffed0fa5 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSSupport.java @@ -55,7 +55,7 @@ public class AmazfitBipSSupport extends AmazfitBipSupport { @Override public void onNotification(NotificationSpec notificationSpec) { - super.sendNotificationNew(notificationSpec, true); + super.sendNotificationNew(notificationSpec, true, 512); } @Override