From 1823cd3f2487892b447b6701521ea1e81aef0ab3 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 24 Sep 2017 13:00:59 +0200 Subject: [PATCH] extended bolus dialog refactor --- .../dialogs/NewExtendedBolusDialog.java | 11 +- .../overview_newextendedbolus_dialog.xml | 201 ++++++------------ 2 files changed, 75 insertions(+), 137 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java index be635e76b6..bbe886b60d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java @@ -30,14 +30,15 @@ import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.Overview.Notification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; +import info.nightscout.utils.NumberPicker; import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.SafeParse; public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(NewExtendedBolusDialog.class); - PlusMinusEditText editInsulin; - PlusMinusEditText editDuration; + NumberPicker editInsulin; + NumberPicker editDuration; Handler mHandler; public static HandlerThread mHandlerThread; @@ -56,11 +57,13 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli View view = inflater.inflate(R.layout.overview_newextendedbolus_dialog, container, false); 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.1d, new DecimalFormat("0.00"), false); + editInsulin = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_insulin); + editInsulin.setParams(0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false); double extendedDurationStep = MainApp.getConfigBuilder().getPumpDescription().extendedBolusDurationStep; double extendedMaxDuration = MainApp.getConfigBuilder().getPumpDescription().extendedBolusMaxDuration; - editDuration = new PlusMinusEditText(view, R.id.overview_newextendedbolus_duration, R.id.overview_newextendedbolus_duration_plus, R.id.overview_newextendedbolus_duration_minus, extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false); + editDuration = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_duration); + editDuration.setParams(extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false); view.findViewById(R.id.ok).setOnClickListener(this); view.findViewById(R.id.cancel).setOnClickListener(this); diff --git a/app/src/main/res/layout/overview_newextendedbolus_dialog.xml b/app/src/main/res/layout/overview_newextendedbolus_dialog.xml index f89fa2e2ae..7d27242f32 100644 --- a/app/src/main/res/layout/overview_newextendedbolus_dialog.xml +++ b/app/src/main/res/layout/overview_newextendedbolus_dialog.xml @@ -1,145 +1,80 @@ - + android:minWidth="300dp" + android:orientation="vertical" + android:padding="10dp"> - + android:layout_height="wrap_content" + android:orientation="horizontal"> - + - + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file