Merge pull request #1 from AdrianLxM/watchworks

delta granularity and NPE fix
This commit is contained in:
Andrew Warrington 2017-12-01 20:51:12 +01:00 committed by GitHub
commit a0a5768dea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 20 deletions

View file

@ -274,12 +274,20 @@ public class WatchUpdaterService extends WearableListenerService implements
}
boolean detailed = SP.getBoolean("wear_detailed_delta", false);
if (units.equals(Constants.MGDL)) {
if (detailed) {
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMGDL));
} else {
deltastring += DecimalFormatter.to0Decimal(Math.abs(deltaMGDL));
}
} else {
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

View file

@ -772,5 +772,17 @@
<string name="key_missed_bg_readings_threshold" translatable="false">missed_bg_readings_threshold</string>
<string name="urgent_alarm">Urgent Alarm</string>
<string name="info">INFO</string>
<string name="key_btwatchdog" translatable="false">bt_watchdog</string>
<string name="key_btwatchdog_lastbark" translatable="false">bt_watchdog_last</string>
<string name="bluetooth">Bluetooth</string>
<string name="btwatchdog_title">BT Watchdog</string>
<string name="btwatchdog_summary">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.</string>
<string name="DexcomG5">DexcomG5 App (patched)</string>
<string name="dexcomg5_nsupload_title">Upload BG data to NS</string>
<string name="key_dexcomg5_nsupload">dexcomg5_nsupload</string>
<string name="dexcomg5_upload">G5 upload settings</string>
<string name="customapp">Customized APK for download</string>
<string name="wear_detailed_delta_title">Show detailed delta</string>
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
</resources>

View file

@ -4,6 +4,9 @@
android:key="wearplugin"
android:title="@string/wear_settings">
<PreferenceScreen
android:title="@string/wear_settings">
<SwitchPreference
android:defaultValue="false"
android:key="wearcontrol"
@ -16,12 +19,17 @@
android:summary="@string/wear_detailedIOB_summary"
android:title="@string/wear_detailedIOB_title" />
<SwitchPreference
android:defaultValue="false"
android:key="wear_detailed_delta"
android:summary="@string/wear_detailed_delta_summary"
android:title="@string/wear_detailed_delta_title" />
<SwitchPreference
android:defaultValue="false"
android:key="wear_showbgi"
android:summary="@string/wear_showbgi_summary"
android:title="@string/wear_showbgi_title" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>