visualize absolute rate emulation as percentage

This commit is contained in:
AdrianLxM 2017-06-29 14:13:22 +02:00
parent a8338b2dd1
commit 16e360f200
3 changed files with 18 additions and 0 deletions

View file

@ -10,6 +10,7 @@ import java.util.Date;
import java.util.Objects;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Iob;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
@ -18,6 +19,7 @@ import info.nightscout.androidaps.interfaces.Interval;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SP;
/**
* Created by mike on 21.05.2017.
@ -271,6 +273,15 @@ public class TemporaryBasal implements Interval {
public String toStringShort() {
if (isAbsolute) {
if(SP.getBoolean(R.string.key_danar_visualizeextendedaspercentage, false)){
Profile profile = MainApp.getConfigBuilder().getProfile();
if(profile != null) {
double basal = profile.getBasal(System.currentTimeMillis());
if(basal != 0){
return Math.round(absoluteRate*100d/basal) + "% ";
}
}
}
return DecimalFormatter.to2Decimal(absoluteRate) + "U/h ";
} else { // percent
return percentRate + "% ";

View file

@ -532,6 +532,7 @@
<string name="key_danar_bt_name" translatable="false">danar_bt_name</string>
<string name="key_danar_password" translatable="false">danar_password</string>
<string name="key_danar_useextended" translatable="false">danar_useextended</string>
<string name="key_danar_visualizeextendedaspercentage" translatable="false">danar_visualizeextendedaspercentage"</string>
<string name="key_danarprofile_dia" translatable="false">danarprofile_dia</string>
<string name="clearlog">Clear log</string>
<string name="key_nsclientinternal_autoscroll" translatable="false">nsclientinternal_autoscroll</string>
@ -650,4 +651,5 @@
<string name="openaps">OpenAPS</string>
<string name="device">Device</string>
<string name="uploader">Uploader</string>
<string name="danar_visualizeextendedaspercentage_title">Visualize extended bolus as %</string>
</resources>

View file

@ -17,6 +17,11 @@
android:defaultValue="false"
android:key="@string/key_danar_useextended"
android:title="@string/danar_useextended_title" />
<SwitchPreference
android:defaultValue="false"
android:dependency="@string/key_danar_useextended"
android:key="@string/key_danar_visualizeextendedaspercentage"
android:title="@string/danar_visualizeextendedaspercentage_title" />
</PreferenceCategory>
</PreferenceScreen>