wear setting to show detailed IOB
This commit is contained in:
parent
cd49c28645
commit
d113d39916
5 changed files with 33 additions and 4 deletions
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
|
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||||
import info.nightscout.utils.LocaleHelper;
|
import info.nightscout.utils.LocaleHelper;
|
||||||
|
|
||||||
public class PreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
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_others);
|
||||||
addPreferencesFromResource(R.xml.pref_advanced);
|
addPreferencesFromResource(R.xml.pref_advanced);
|
||||||
initSummary(getPreferenceScreen());
|
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) {
|
public Preference getPreference (String key) {
|
||||||
|
|
|
@ -120,8 +120,10 @@ public class WearPlugin implements PluginBase {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(final EventPreferenceChange ev) {
|
public void onStatusEvent(final EventPreferenceChange ev) {
|
||||||
//possibly new high or low mark
|
// possibly new high or low mark
|
||||||
resendDataToWatch();
|
resendDataToWatch();
|
||||||
|
// status may be formated differently
|
||||||
|
sendDataToWatch(true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -520,9 +520,13 @@ public class WatchUpdaterService extends WearableListenerService implements
|
||||||
IobTotal bolusIob = MainApp.getConfigBuilder().getActiveTreatments().getLastCalculation().round();
|
IobTotal bolusIob = MainApp.getConfigBuilder().getActiveTreatments().getLastCalculation().round();
|
||||||
MainApp.getConfigBuilder().getActiveTempBasals().updateTotalIOB();
|
MainApp.getConfigBuilder().getActiveTempBasals().updateTotalIOB();
|
||||||
IobTotal basalIob = MainApp.getConfigBuilder().getActiveTempBasals().getLastCalculation().round();
|
IobTotal basalIob = MainApp.getConfigBuilder().getActiveTempBasals().getLastCalculation().round();
|
||||||
status += (shortString?"":(getString(R.string.treatments_iob_label_string) + " ")) + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "("
|
status += (shortString?"":(getString(R.string.treatments_iob_label_string) + " ")) + DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||||
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
|
|
||||||
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
if (mPrefs.getBoolean("wear_detailediob", true)) {
|
||||||
|
status += "("
|
||||||
|
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
|
||||||
|
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
||||||
//unique content
|
//unique content
|
||||||
|
|
|
@ -507,4 +507,7 @@
|
||||||
<string name="settings_password">Password for settings</string>
|
<string name="settings_password">Password for settings</string>
|
||||||
<string name="unlock_settings">Unlock settings</string>
|
<string name="unlock_settings">Unlock settings</string>
|
||||||
<string name="approachingdailylimit">Approaching insulin daily limit</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>
|
</resources>
|
||||||
|
|
14
app/src/main/res/xml/pref_wear.xml
Normal file
14
app/src/main/res/xml/pref_wear.xml
Normal 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>
|
Loading…
Reference in a new issue