From 98777579c854999cc71b16a09ca2dddc8e1775d5 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Fri, 1 Dec 2017 20:28:34 +0100 Subject: [PATCH] delta granularity and NPE fix --- .../wearintegration/WatchUpdaterService.java | 21 ++++++++-- app/src/main/res/values/strings.xml | 12 ++++++ app/src/main/res/xml/pref_wear.xml | 40 +++++++++++-------- 3 files changed, 53 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index f787d00512..9a7eed1fd7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -274,12 +274,20 @@ public class WatchUpdaterService extends WearableListenerService implements } + boolean detailed = SP.getBoolean("wear_detailed_delta", false); if (units.equals(Constants.MGDL)) { - deltastring += DecimalFormatter.to0Decimal(Math.abs(deltaMGDL)); + if (detailed) { + deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMGDL)); + } else { + deltastring += DecimalFormatter.to0Decimal(Math.abs(deltaMGDL)); + } } else { - deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL)); + if (detailed){ + deltastring += DecimalFormatter.to2Decimal(Math.abs(deltaMMOL)); + } else { + deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL)); + } } - return deltastring; } @@ -545,7 +553,12 @@ public class WatchUpdaterService extends WearableListenerService implements //OpenAPS status String openApsString = String.valueOf(NSDeviceStatus.getInstance().getOpenApsStatus()); - String openApsStatus = openApsString.substring(0,openApsString.indexOf("m")); + String openApsStatus = ""; + if(openApsString != null) { + int index = openApsString.indexOf("m"); + if(index > 0) + openApsStatus = openApsString.substring(0, index); + } PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH); //unique content diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0e2833c970..e8918979b3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -772,5 +772,17 @@ missed_bg_readings_threshold Urgent Alarm INFO + bt_watchdog + bt_watchdog_last + Bluetooth + BT Watchdog + Switches off the phone\'s bluetooth for one second if no connection to the pump is possible. This may help on some phones where the bluetooth stack freezes. + DexcomG5 App (patched) + Upload BG data to NS + dexcomg5_nsupload + G5 upload settings + Customized APK for download + Show detailed delta + Show delta with one more decimal place diff --git a/app/src/main/res/xml/pref_wear.xml b/app/src/main/res/xml/pref_wear.xml index bd6c42725a..406e156ab3 100644 --- a/app/src/main/res/xml/pref_wear.xml +++ b/app/src/main/res/xml/pref_wear.xml @@ -4,24 +4,32 @@ android:key="wearplugin" android:title="@string/wear_settings"> - + - + - + + + + + - \ No newline at end of file