Merge pull request #241 from AdrianLxM/xdripstatusline

Get correct calibration value if entered with (onboard) keyboard
This commit is contained in:
Milos Kozak 2017-05-12 23:12:49 +02:00 committed by GitHub
commit b19bf628b8

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.XdripCalibrations; import info.nightscout.utils.XdripCalibrations;
public class CalibrationDialog extends DialogFragment implements View.OnClickListener { public class CalibrationDialog extends DialogFragment implements View.OnClickListener {
@ -34,6 +35,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
Button okButton; Button okButton;
PlusMinusEditText bgText; PlusMinusEditText bgText;
TextView unitsView; TextView unitsView;
TextView bgView;
Context context; Context context;
@ -72,6 +74,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units); unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
unitsView.setText(units); unitsView.setText(units);
bgView = (TextView) view.findViewById(R.id.overview_calibration_bg);
return view; return view;
} }
@ -80,7 +83,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.overview_calibration_okbutton: case R.id.overview_calibration_okbutton:
final Double bg = bgText.getValue(); final Double bg = SafeParse.stringToDouble(this.bgView.getText().toString());;
XdripCalibrations.confirmAndSendCalibration(bg, context); XdripCalibrations.confirmAndSendCalibration(bg, context);
dismiss(); dismiss();
Answers.getInstance().logCustom(new CustomEvent("Calibration")); Answers.getInstance().logCustom(new CustomEvent("Calibration"));