From 6fff6f63a4e8984022d283568b1353d8887d9986 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 16 May 2017 12:09:32 +0200 Subject: [PATCH] bolus dialog redesign --- .../Overview/Dialogs/NewTreatmentDialog.java | 14 +- .../careportal_newnstreatment_dialog.xml | 10 - .../layout/overview_newtreatment_dialog.xml | 226 +++++++++--------- 3 files changed, 126 insertions(+), 124 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index e97104437d..8144d39ff5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -31,7 +31,8 @@ import info.nightscout.utils.SafeParse; public class NewTreatmentDialog extends DialogFragment implements OnClickListener { - Button deliverButton; + Button okButton; + Button cancelButton; TextView insulin; TextView carbs; @@ -52,9 +53,11 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene Bundle savedInstanceState) { View view = inflater.inflate(R.layout.overview_newtreatment_dialog, null, false); - deliverButton = (Button) view.findViewById(R.id.treatments_newtreatment_deliverbutton); + okButton = (Button) view.findViewById(R.id.ok); + okButton.setOnClickListener(this); + cancelButton = (Button) view.findViewById(R.id.cancel); + cancelButton.setOnClickListener(this); - deliverButton.setOnClickListener(this); getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount); @@ -79,7 +82,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene @Override public void onClick(View view) { switch (view.getId()) { - case R.id.treatments_newtreatment_deliverbutton: + case R.id.ok: try { Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString()); @@ -131,6 +134,9 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene e.printStackTrace(); } break; + case R.id.cancel: + dismiss(); + break; } } diff --git a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml index f907150f1b..59c43c3cad 100644 --- a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml +++ b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml @@ -207,16 +207,6 @@ android:layout_marginTop="5dp" android:background="@color/listdelimiter" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content"> -