From 2b01b2a10bf59bcef8c7001f2ea4cd363b018f2a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 3 Jul 2016 13:46:49 +0200 Subject: [PATCH] combobolus dialog plus/minus buttons --- .../Dialogs/NewExtendedBolusDialog.java | 9 +++ .../overview_newextendedbolus_fragment.xml | 71 +++++++++++++------ 2 files changed, 59 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java index 2f0aa5e15a..85a41ac66d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewExtendedBolusDialog.java @@ -11,10 +11,14 @@ import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; +import java.text.DecimalFormat; + +import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.interfaces.PumpInterface; +import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.SafeParse; public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener { @@ -27,6 +31,8 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli RadioButton h30Radio; RadioButton h40Radio; + PlusMinusEditText editInsulin; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -41,6 +47,9 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli h30Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_3h); h40Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_4h); + Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit); + editInsulin = new PlusMinusEditText(view, R.id.overview_newextendedbolus_insulin, R.id.overview_newextendedbolus_insulin_plus, R.id.overview_newextendedbolus_insulin_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"), false); + okButton.setOnClickListener(this); return view; } diff --git a/app/src/main/res/layout/overview_newextendedbolus_fragment.xml b/app/src/main/res/layout/overview_newextendedbolus_fragment.xml index 61c9020b0e..574cb546a6 100644 --- a/app/src/main/res/layout/overview_newextendedbolus_fragment.xml +++ b/app/src/main/res/layout/overview_newextendedbolus_fragment.xml @@ -18,16 +18,45 @@ android:text="@string/treatments_newtreatment_insulinamount_label" android:textAppearance="?android:attr/textAppearanceLarge" /> - + android:orientation="horizontal"> + + + + + + + + - - + android:checked="true" + android:text="0.5 h" /> + android:text="1 h" /> + android:text="2 h" /> + android:text="3 h" /> + +