add sum to basal in lp
This commit is contained in:
parent
39b18915d0
commit
4667a047ea
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.ProfileLocal;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -27,6 +28,7 @@ import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
|||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NumberPicker;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.TimeListEdit;
|
||||
|
@ -57,6 +59,9 @@ public class LocalProfileFragment extends SubscriberFragment {
|
|||
@Override
|
||||
public void run() {
|
||||
localProfilePlugin.storeSettings();
|
||||
if(basalView!=null){
|
||||
basalView.updateLabel(MainApp.sResources.getString(R.string.nsprofileview_basal_label)+ ": "+ getSumLabel());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -86,7 +91,7 @@ public class LocalProfileFragment extends SubscriberFragment {
|
|||
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", getPlugin().ic, null, 0.1d, new DecimalFormat("0.0"), save);
|
||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", getPlugin().isf, null, 0.1d, new DecimalFormat("0.0"), save);
|
||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label)+ ":", getPlugin().basal, null, 0.01d, new DecimalFormat("0.00"), save);
|
||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label)+ ": " + getSumLabel(), getPlugin().basal, null, 0.01d, new DecimalFormat("0.00"), save);
|
||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label)+ ":", getPlugin().targetLow, getPlugin().targetHigh, 0.1d, new DecimalFormat("0.0"), save);
|
||||
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
||||
|
||||
|
@ -141,6 +146,11 @@ public class LocalProfileFragment extends SubscriberFragment {
|
|||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getSumLabel() {
|
||||
return " ∑" + DecimalFormatter.to2Decimal(localProfilePlugin.getProfile().getDefaultProfile().baseBasalSum()) +"U";
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged e) {
|
||||
updateGUI();
|
||||
|
|
|
@ -54,8 +54,10 @@ public class TimeListEdit {
|
|||
private NumberFormat formatter;
|
||||
private Runnable save;
|
||||
private LinearLayout layout;
|
||||
private TextView textlabel;
|
||||
private int inflatedUntil = -1;
|
||||
|
||||
|
||||
public TimeListEdit(Context context, View view, int resLayoutId, String label, JSONArray data1, JSONArray data2, double step, NumberFormat formatter, Runnable save) {
|
||||
this.context = context;
|
||||
this.view = view;
|
||||
|
@ -72,7 +74,7 @@ public class TimeListEdit {
|
|||
private void buildView() {
|
||||
layout = (LinearLayout) view.findViewById(resLayoutId);
|
||||
|
||||
TextView textlabel = new TextView(context);
|
||||
textlabel = new TextView(context);
|
||||
textlabel.setText(label);
|
||||
textlabel.setGravity(Gravity.START);
|
||||
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
@ -385,4 +387,10 @@ public class TimeListEdit {
|
|||
private void callSave() {
|
||||
if (save != null) save.run();
|
||||
}
|
||||
|
||||
public void updateLabel(String txt){
|
||||
this.label = txt;
|
||||
if(textlabel!=null)
|
||||
textlabel.setText(txt);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue