wear setting to show detailed IOB

This commit is contained in:
AdrianLxM 2017-02-18 18:13:13 +01:00
parent cd49c28645
commit d113d39916
5 changed files with 33 additions and 4 deletions

View file

@ -20,6 +20,7 @@ import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
import info.nightscout.utils.LocaleHelper;
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -115,6 +116,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_others);
addPreferencesFromResource(R.xml.pref_advanced);
initSummary(getPreferenceScreen());
WearPlugin wearPlugin = (WearPlugin) MainApp.getSpecificPlugin(WearPlugin.class);
if (wearPlugin != null && wearPlugin.isEnabled(PluginBase.GENERAL)) {
addPreferencesFromResource(R.xml.pref_wear);
}
}
public Preference getPreference (String key) {

View file

@ -120,8 +120,10 @@ public class WearPlugin implements PluginBase {
@Subscribe
public void onStatusEvent(final EventPreferenceChange ev) {
//possibly new high or low mark
// possibly new high or low mark
resendDataToWatch();
// status may be formated differently
sendDataToWatch(true, false, false);
}
@Subscribe

View file

@ -520,9 +520,13 @@ public class WatchUpdaterService extends WearableListenerService implements
IobTotal bolusIob = MainApp.getConfigBuilder().getActiveTreatments().getLastCalculation().round();
MainApp.getConfigBuilder().getActiveTempBasals().updateTotalIOB();
IobTotal basalIob = MainApp.getConfigBuilder().getActiveTempBasals().getLastCalculation().round();
status += (shortString?"":(getString(R.string.treatments_iob_label_string) + " ")) + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "("
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
status += (shortString?"":(getString(R.string.treatments_iob_label_string) + " ")) + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
if (mPrefs.getBoolean("wear_detailediob", true)) {
status += "("
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
}
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
//unique content

View file

@ -507,4 +507,7 @@
<string name="settings_password">Password for settings</string>
<string name="unlock_settings">Unlock settings</string>
<string name="approachingdailylimit">Approaching insulin daily limit</string>
<string name="wear_settings">Wear settings</string>
<string name="wear_detailedIOB_title">Show detailed IOB</string>
<string name="wear_detailedIOB_summary">Break down IOB into bolus and basal IOB on the watchface</string>
</resources>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="wearplugin"
android:title="@string/wear_settings">
<SwitchPreference
android:defaultValue="true"
android:key="wear_detailediob"
android:title="@string/wear_detailedIOB_title"
android:summary="@string/wear_detailedIOB_summary"/>
</PreferenceCategory>
</PreferenceScreen>