From 341b0660a837d81a8ec5880b3c5e582d80d63388 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 27 Jun 2017 15:25:11 +0200 Subject: [PATCH] calibration dialog cancel button --- .../plugins/Overview/Dialogs/CalibrationDialog.java | 10 ++++++---- .../main/res/layout/overview_calibration_dialog.xml | 12 +++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java index aa1d51f4dd..8bba8ceda2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/CalibrationDialog.java @@ -32,7 +32,6 @@ import info.nightscout.utils.XdripCalibrations; public class CalibrationDialog extends DialogFragment implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(CalibrationDialog.class); - Button okButton; PlusMinusEditText bgText; TextView unitsView; TextView bgView; @@ -57,8 +56,8 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); - okButton = (Button) view.findViewById(R.id.overview_calibration_okbutton); - okButton.setOnClickListener(this); + view.findViewById(R.id.ok).setOnClickListener(this); + view.findViewById(R.id.cancel).setOnClickListener(this); String units = MainApp.getConfigBuilder().getProfileUnits(); Double bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, units); @@ -78,13 +77,16 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis @Override public void onClick(View view) { switch (view.getId()) { - case R.id.overview_calibration_okbutton: + case R.id.ok: final Double bg = SafeParse.stringToDouble(this.bgView.getText().toString()); ; XdripCalibrations.confirmAndSendCalibration(bg, context); dismiss(); Answers.getInstance().logCustom(new CustomEvent("Calibration")); break; + case R.id.cancel: + dismiss(); + break; } } } diff --git a/app/src/main/res/layout/overview_calibration_dialog.xml b/app/src/main/res/layout/overview_calibration_dialog.xml index 2118b9b274..8981ac9ff8 100644 --- a/app/src/main/res/layout/overview_calibration_dialog.xml +++ b/app/src/main/res/layout/overview_calibration_dialog.xml @@ -40,6 +40,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" android:orientation="horizontal"> @@ -81,15 +83,7 @@ -