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 (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 { } else {
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL)); if (detailed){
deltastring += DecimalFormatter.to2Decimal(Math.abs(deltaMMOL));
} else {
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL));
}
} }
return deltastring; return deltastring;
} }
@ -545,7 +553,12 @@ public class WatchUpdaterService extends WearableListenerService implements
//OpenAPS status //OpenAPS status
String openApsString = String.valueOf(NSDeviceStatus.getInstance().getOpenApsStatus()); 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); PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
//unique content //unique content

View file

@ -772,5 +772,17 @@
<string name="key_missed_bg_readings_threshold" translatable="false">missed_bg_readings_threshold</string> <string name="key_missed_bg_readings_threshold" translatable="false">missed_bg_readings_threshold</string>
<string name="urgent_alarm">Urgent Alarm</string> <string name="urgent_alarm">Urgent Alarm</string>
<string name="info">INFO</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> </resources>

View file

@ -4,24 +4,32 @@
android:key="wearplugin" android:key="wearplugin"
android:title="@string/wear_settings"> android:title="@string/wear_settings">
<SwitchPreference <PreferenceScreen
android:defaultValue="false" android:title="@string/wear_settings">
android:key="wearcontrol"
android:summary="@string/wearcontrol_summary"
android:title="@string/wearcontrol_title" />
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="false"
android:key="wear_detailediob" android:key="wearcontrol"
android:summary="@string/wear_detailedIOB_summary" android:summary="@string/wearcontrol_summary"
android:title="@string/wear_detailedIOB_title" /> android:title="@string/wearcontrol_title" />
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="true"
android:key="wear_showbgi" android:key="wear_detailediob"
android:summary="@string/wear_showbgi_summary" android:summary="@string/wear_detailedIOB_summary"
android:title="@string/wear_showbgi_title" /> 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> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>