This commit is contained in:
Milos Kozak 2017-06-28 09:09:29 +02:00
commit e4d55473a1
15 changed files with 484 additions and 450 deletions

View file

@ -44,7 +44,7 @@ android {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 23 targetSdkVersion 23
versionCode 1500 versionCode 1500
version "1.5" version "1.5a"
buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", generateGitBuild() buildConfigField "String", "BUILDVERSION", generateGitBuild()
} }

View file

@ -71,7 +71,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (getDialog() != null) if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); getDialog().getWindow().setLayout(1000, ViewGroup.LayoutParams.WRAP_CONTENT);
MainApp.bus().register(this); MainApp.bus().register(this);
running = true; running = true;
if (bolusEnded) dismiss(); if (bolusEnded) dismiss();

View file

@ -9,7 +9,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.Answers; import com.crashlytics.android.answers.Answers;
@ -25,17 +24,15 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse; 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 {
private static Logger log = LoggerFactory.getLogger(CalibrationDialog.class); private static Logger log = LoggerFactory.getLogger(CalibrationDialog.class);
Button okButton; NumberPicker bgNumber;
PlusMinusEditText bgText;
TextView unitsView; TextView unitsView;
TextView bgView;
Context context; Context context;
@ -57,20 +54,21 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
okButton = (Button) view.findViewById(R.id.overview_calibration_okbutton); view.findViewById(R.id.ok).setOnClickListener(this);
okButton.setOnClickListener(this); view.findViewById(R.id.cancel).setOnClickListener(this);
String units = MainApp.getConfigBuilder().getProfileUnits(); String units = MainApp.getConfigBuilder().getProfileUnits();
Double bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, units); Double bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, units);
if (units.equals(Constants.MMOL)) bgNumber = (NumberPicker) view.findViewById(R.id.overview_calibration_bg);
bgText = new PlusMinusEditText(view, R.id.overview_calibration_bg, R.id.overview_calibration_bg_plus, R.id.overview_calibration_bg_minus, bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
if (units.equals(Constants.MMOL))
bgNumber.setParams(bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
else else
bgText = new PlusMinusEditText(view, R.id.overview_calibration_bg, R.id.overview_calibration_bg_plus, R.id.overview_calibration_bg_minus, bg, 0d, 500d, 1d, new DecimalFormat("0"), false); bgNumber.setParams(bg, 0d, 500d, 1d, new DecimalFormat("0"), false);
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;
} }
@ -78,13 +76,15 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
@Override @Override
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.ok:
final Double bg = SafeParse.stringToDouble(this.bgView.getText().toString()); final Double bg = SafeParse.stringToDouble(bgNumber.getText());
;
XdripCalibrations.confirmAndSendCalibration(bg, context); XdripCalibrations.confirmAndSendCalibration(bg, context);
dismiss(); dismiss();
Answers.getInstance().logCustom(new CustomEvent("Calibration")); Answers.getInstance().logCustom(new CustomEvent("Calibration"));
break; break;
case R.id.cancel:
dismiss();
break;
} }
} }
} }

View file

@ -29,13 +29,14 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
public class NewTreatmentDialog extends DialogFragment implements OnClickListener { public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
PlusMinusEditText editCarbs; NumberPicker editCarbs;
PlusMinusEditText editInsulin; NumberPicker editInsulin;
Handler mHandler; Handler mHandler;
public static HandlerThread mHandlerThread; public static HandlerThread mHandlerThread;
@ -49,7 +50,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.overview_newtreatment_dialog, null, false); View view = inflater.inflate(R.layout.overview_newtreatment_dialog, container, false);
view.findViewById(R.id.ok).setOnClickListener(this); view.findViewById(R.id.ok).setOnClickListener(this);
view.findViewById(R.id.cancel).setOnClickListener(this); view.findViewById(R.id.cancel).setOnClickListener(this);
@ -60,19 +61,15 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit); Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit); Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
editCarbs = new PlusMinusEditText(view, R.id.treatments_newtreatment_carbsamount, R.id.treatments_newtreatment_carbsamount_plus, R.id.treatments_newtreatment_carbsamount_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false); editCarbs = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_carbsamount);
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, MainApp.getConfigBuilder().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false); editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
editInsulin.setParams(0d, 0d, maxInsulin, MainApp.getConfigBuilder().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false);
return view; return view;
} }
@Override
public void onResume() {
super.onResume();
if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {

View file

@ -60,6 +60,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui
import info.nightscout.utils.BolusWizard; import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.OKDialog; import info.nightscout.utils.OKDialog;
import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
@ -69,10 +70,7 @@ import info.nightscout.utils.ToastUtils;
public class WizardDialog extends DialogFragment implements OnClickListener, CompoundButton.OnCheckedChangeListener, Spinner.OnItemSelectedListener { public class WizardDialog extends DialogFragment implements OnClickListener, CompoundButton.OnCheckedChangeListener, Spinner.OnItemSelectedListener {
private static Logger log = LoggerFactory.getLogger(WizardDialog.class); private static Logger log = LoggerFactory.getLogger(WizardDialog.class);
Button wizardDialogDeliverButton; Button okButton;
TextView correctionInput;
TextView carbsInput;
TextView bgInput;
TextView bg; TextView bg;
TextView bgInsulin; TextView bgInsulin;
TextView bgUnits; TextView bgUnits;
@ -85,8 +83,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
CheckBox basalIobCheckbox; CheckBox basalIobCheckbox;
TextView correctionInsulin; TextView correctionInsulin;
TextView total; TextView total;
TextView totalInsulin;
EditText carbTimeEdit;
Spinner profileSpinner; Spinner profileSpinner;
CheckBox superbolusCheckbox; CheckBox superbolusCheckbox;
TextView superbolus; TextView superbolus;
@ -99,10 +95,10 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
TextView cob; TextView cob;
TextView cobInsulin; TextView cobInsulin;
PlusMinusEditText editBg; NumberPicker editBg;
PlusMinusEditText editCarbs; NumberPicker editCarbs;
PlusMinusEditText editCorr; NumberPicker editCorr;
PlusMinusEditText editCarbTime; NumberPicker editCarbTime;
Integer calculatedCarbs = 0; Integer calculatedCarbs = 0;
Double calculatedTotalInsulin = 0d; Double calculatedTotalInsulin = 0d;
@ -129,9 +125,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onPause();
if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
MainApp.bus().register(this); MainApp.bus().register(this);
} }
@ -195,8 +189,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
wizardDialogDeliverButton = (Button) view.findViewById(R.id.treatments_wizard_deliverButton); okButton = (Button) view.findViewById(R.id.ok);
wizardDialogDeliverButton.setOnClickListener(this); okButton.setOnClickListener(this);
view.findViewById(R.id.cancel).setOnClickListener(this);
bg = (TextView) view.findViewById(R.id.treatments_wizard_bg); bg = (TextView) view.findViewById(R.id.treatments_wizard_bg);
bgInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bginsulin); bgInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bginsulin);
@ -207,8 +202,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
basalIobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_basaliobinsulin); basalIobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_basaliobinsulin);
correctionInsulin = (TextView) view.findViewById(R.id.treatments_wizard_correctioninsulin); correctionInsulin = (TextView) view.findViewById(R.id.treatments_wizard_correctioninsulin);
total = (TextView) view.findViewById(R.id.treatments_wizard_total); total = (TextView) view.findViewById(R.id.treatments_wizard_total);
totalInsulin = (TextView) view.findViewById(R.id.treatments_wizard_totalinsulin);
carbTimeEdit = (EditText) view.findViewById(R.id.treatments_wizard_carbtimeinput);
superbolus = (TextView) view.findViewById(R.id.treatments_wizard_sb); superbolus = (TextView) view.findViewById(R.id.treatments_wizard_sb);
superbolusInsulin = (TextView) view.findViewById(R.id.treatments_wizard_sbinsulin); superbolusInsulin = (TextView) view.findViewById(R.id.treatments_wizard_sbinsulin);
@ -236,22 +229,20 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
profileSpinner = (Spinner) view.findViewById(R.id.treatments_wizard_profile); profileSpinner = (Spinner) view.findViewById(R.id.treatments_wizard_profile);
profileSpinner.setOnItemSelectedListener(this); profileSpinner.setOnItemSelectedListener(this);
correctionInput = (TextView) view.findViewById(R.id.treatments_wizard_correctioninput); editCarbTime = (NumberPicker) view.findViewById(R.id.treatments_wizard_carbtimeinput);
carbsInput = (TextView) view.findViewById(R.id.treatments_wizard_carbsinput); editCorr = (NumberPicker) view.findViewById(R.id.treatments_wizard_correctioninput);
bgInput = (TextView) view.findViewById(R.id.treatments_wizard_bginput); editCarbs = (NumberPicker) view.findViewById(R.id.treatments_wizard_carbsinput);
correctionInput.addTextChangedListener(textWatcher); editBg = (NumberPicker) view.findViewById(R.id.treatments_wizard_bginput);
carbsInput.addTextChangedListener(textWatcher);
bgInput.addTextChangedListener(textWatcher);
superbolusCheckbox.setVisibility(SP.getBoolean(R.string.key_usesuperbolus, false) ? View.VISIBLE : View.GONE); superbolusCheckbox.setVisibility(SP.getBoolean(R.string.key_usesuperbolus, false) ? View.VISIBLE : View.GONE);
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit); Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit); Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
editBg = new PlusMinusEditText(view, R.id.treatments_wizard_bginput, R.id.treatments_wizard_bginput_plus, R.id.treatments_wizard_bginput_minus, 0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false); editBg.setParams(0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false, textWatcher);
editCarbs = new PlusMinusEditText(view, R.id.treatments_wizard_carbsinput, R.id.treatments_wizard_carbsinput_plus, R.id.treatments_wizard_carbsinput_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false); editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
editCorr = new PlusMinusEditText(view, R.id.treatments_wizard_correctioninput, R.id.treatments_wizard_correctioninput_plus, R.id.treatments_wizard_correctioninput_minus, 0d, -maxCorrection, maxCorrection, 0.05d, new DecimalFormat("0.00"), false); editCorr.setParams(0d, -maxCorrection, maxCorrection, 0.05d, new DecimalFormat("0.00"), false, textWatcher);
editCarbTime = new PlusMinusEditText(view, R.id.treatments_wizard_carbtimeinput, R.id.treatments_wizard_carbtime_plus, R.id.treatments_wizard_carbtime_minus, 0d, -60d, 60d, 5d, new DecimalFormat("0"), false); editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
initDialog(); initDialog();
return view; return view;
@ -265,19 +256,19 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
calculateInsulin(); calculateInsulin();
wizardDialogDeliverButton.setVisibility(View.VISIBLE); okButton.setVisibility(View.VISIBLE);
} }
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.noprofileselected)); ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.noprofileselected));
wizardDialogDeliverButton.setVisibility(View.GONE); okButton.setVisibility(View.GONE);
} }
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.treatments_wizard_deliverButton: case R.id.ok:
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) { if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00"); DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
String confirmMessage = getString(R.string.entertreatmentquestion); String confirmMessage = getString(R.string.entertreatmentquestion);
@ -299,8 +290,8 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
final Double finalInsulinAfterConstraints = insulinAfterConstraints; final Double finalInsulinAfterConstraints = insulinAfterConstraints;
final Integer finalCarbsAfterConstraints = carbsAfterConstraints; final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
final Double bg = SafeParse.stringToDouble(bgInput.getText().toString()); final Double bg = SafeParse.stringToDouble(editBg.getText());
final int carbTime = SafeParse.stringToInt(carbTimeEdit.getText().toString()); final int carbTime = SafeParse.stringToInt(editCarbTime.getText());
final boolean useSuperBolus = superbolusCheckbox.isChecked(); final boolean useSuperBolus = superbolusCheckbox.isChecked();
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
@ -350,6 +341,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
dismiss(); dismiss();
} }
break; break;
case R.id.cancel:
dismiss();
break;
} }
} }
@ -396,17 +390,17 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
bg.setText(lastBg.valueToUnitsToString(units) + " ISF: " + DecimalFormatter.to1Decimal(sens)); bg.setText(lastBg.valueToUnitsToString(units) + " ISF: " + DecimalFormatter.to1Decimal(sens));
bgInsulin.setText(DecimalFormatter.to2Decimal(bgDiff / sens) + "U"); bgInsulin.setText(DecimalFormatter.to2Decimal(bgDiff / sens) + "U");
bgInput.removeTextChangedListener(textWatcher); editBg.removeTextChangedListener(textWatcher);
//bgInput.setText(lastBg.valueToUnitsToString(units)); //bgInput.setText(lastBg.valueToUnitsToString(units));
editBg.setValue(lastBg.valueToUnits(units)); editBg.setValue(lastBg.valueToUnits(units));
bgInput.addTextChangedListener(textWatcher); editBg.addTextChangedListener(textWatcher);
} else { } else {
bg.setText(""); bg.setText("");
bgInsulin.setText(""); bgInsulin.setText("");
bgInput.removeTextChangedListener(textWatcher); editBg.removeTextChangedListener(textWatcher);
//bgInput.setText(""); //bgInput.setText("");
editBg.setValue(0d); editBg.setValue(0d);
bgInput.addTextChangedListener(textWatcher); editBg.addTextChangedListener(textWatcher);
} }
// IOB calculation // IOB calculation
@ -418,9 +412,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
bolusIobInsulin.setText(DecimalFormatter.to2Decimal(-bolusIob.iob) + "U"); bolusIobInsulin.setText(DecimalFormatter.to2Decimal(-bolusIob.iob) + "U");
basalIobInsulin.setText(DecimalFormatter.to2Decimal(-basalIob.basaliob) + "U"); basalIobInsulin.setText(DecimalFormatter.to2Decimal(-basalIob.basaliob) + "U");
totalInsulin.setText("");
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE);
// COB only if AMA is selected // COB only if AMA is selected
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) { if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
cobLayout.setVisibility(View.VISIBLE); cobLayout.setVisibility(View.VISIBLE);
@ -429,6 +420,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
cobLayout.setVisibility(View.GONE); cobLayout.setVisibility(View.GONE);
cobAvailable = false; cobAvailable = false;
} }
calculateInsulin();
} }
private void calculateInsulin() { private void calculateInsulin() {
@ -439,23 +431,23 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
Profile specificProfile = profile.getSpecificProfile(selectedAlternativeProfile); Profile specificProfile = profile.getSpecificProfile(selectedAlternativeProfile);
// Entered values // Entered values
Double c_bg = SafeParse.stringToDouble(bgInput.getText().toString()); Double c_bg = SafeParse.stringToDouble(editBg.getText());
Integer c_carbs = SafeParse.stringToInt(carbsInput.getText().toString()); Integer c_carbs = SafeParse.stringToInt(editCarbs.getText());
Double c_correction = SafeParse.stringToDouble(correctionInput.getText().toString()); Double c_correction = SafeParse.stringToDouble(editCorr.getText());
Double corrAfterConstraint = MainApp.getConfigBuilder().applyBolusConstraints(c_correction); Double corrAfterConstraint = MainApp.getConfigBuilder().applyBolusConstraints(c_correction);
if (c_correction - corrAfterConstraint != 0) { // c_correction != corrAfterConstraint doesn't work if (c_correction - corrAfterConstraint != 0) { // c_correction != corrAfterConstraint doesn't work
correctionInput.removeTextChangedListener(textWatcher); editCorr.removeTextChangedListener(textWatcher);
correctionInput.setText(""); editCorr.setValue(0d);
correctionInput.addTextChangedListener(textWatcher); editCorr.addTextChangedListener(textWatcher);
//wizardDialogDeliverButton.setVisibility(Button.GONE); //wizardDialogDeliverButton.setVisibility(Button.GONE);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.bolusconstraintapplied)); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.bolusconstraintapplied));
return; return;
} }
Integer carbsAfterConstraint = MainApp.getConfigBuilder().applyCarbsConstraints(c_carbs); Integer carbsAfterConstraint = MainApp.getConfigBuilder().applyCarbsConstraints(c_carbs);
if (c_carbs - carbsAfterConstraint != 0) { if (c_carbs - carbsAfterConstraint != 0) {
carbsInput.removeTextChangedListener(textWatcher); editCarbs.removeTextChangedListener(textWatcher);
carbsInput.setText(""); editCarbs.setValue(0d);
carbsInput.addTextChangedListener(textWatcher); editCarbs.addTextChangedListener(textWatcher);
//wizardDialogDeliverButton.setVisibility(Button.GONE); //wizardDialogDeliverButton.setVisibility(Button.GONE);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.carbsconstraintapplied)); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.carbsconstraintapplied));
return; return;
@ -489,14 +481,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
correctionInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromCorrection) + "U"); correctionInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromCorrection) + "U");
calculatedTotalInsulin = wizard.calculatedTotalInsulin; calculatedTotalInsulin = wizard.calculatedTotalInsulin;
if (calculatedTotalInsulin <= 0) {
total.setText(getString(R.string.missing) + " " + DecimalFormatter.to0Decimal(wizard.carbsEquivalent) + "g");
totalInsulin.setText("");
} else {
total.setText("");
totalInsulin.setText(DecimalFormatter.to2Decimal(calculatedTotalInsulin) + "U");
}
calculatedCarbs = carbsAfterConstraint; calculatedCarbs = carbsAfterConstraint;
// Superbolus // Superbolus
@ -531,10 +515,11 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) { if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
String insulinText = calculatedTotalInsulin > 0d ? (DecimalFormatter.to2Decimal(calculatedTotalInsulin) + "U") : ""; String insulinText = calculatedTotalInsulin > 0d ? (DecimalFormatter.to2Decimal(calculatedTotalInsulin) + "U") : "";
String carbsText = calculatedCarbs > 0d ? (DecimalFormatter.to0Decimal(calculatedCarbs) + "g") : ""; String carbsText = calculatedCarbs > 0d ? (DecimalFormatter.to0Decimal(calculatedCarbs) + "g") : "";
wizardDialogDeliverButton.setText(getString(R.string.send) + " " + insulinText + " " + carbsText); total.setText(getString(R.string.send) + " " + insulinText + " " + carbsText);
wizardDialogDeliverButton.setVisibility(Button.VISIBLE); okButton.setVisibility(View.VISIBLE);
} else { } else {
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE); total.setText(getString(R.string.missing) + " " + DecimalFormatter.to0Decimal(wizard.carbsEquivalent) + "g");
okButton.setVisibility(View.INVISIBLE);
} }
boluscalcJSON = new JSONObject(); boluscalcJSON = new JSONObject();

View file

@ -11,6 +11,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.Services.Intents;
@ -155,7 +156,7 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public String getUnits() { public String getUnits() {
return profile.getUnits(); return profile != null ? profile.getUnits() : Constants.MGDL;
} }
@Override @Override

View file

@ -0,0 +1,248 @@
package info.nightscout.utils;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.NumberFormat;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
/**
* Created by mike on 28.06.2016.
*/
public class NumberPicker extends LinearLayout implements View.OnKeyListener,
View.OnTouchListener, View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(NumberPicker.class);
TextView editText;
Button minusButton;
Button plusButton;
Double value;
Double minValue = 0d;
Double maxValue = 1d;
Double step = 1d;
NumberFormat formater;
boolean allowZero = false;
private Handler mHandler;
private ScheduledExecutorService mUpdater;
private class UpdateCounterTask implements Runnable {
private boolean mInc;
private int repeated = 0;
private int multiplier = 1;
private final int doubleLimit = 5;
public UpdateCounterTask(boolean inc) {
mInc = inc;
}
public void run() {
Message msg = new Message();
if (repeated % doubleLimit == 0) multiplier *= 2;
repeated++;
msg.arg1 = multiplier;
msg.arg2 = repeated;
if (mInc) {
msg.what = MSG_INC;
} else {
msg.what = MSG_DEC;
}
mHandler.sendMessage(msg);
}
}
private static final int MSG_INC = 0;
private static final int MSG_DEC = 1;
public NumberPicker(Context context) {
super(context, null);
}
public NumberPicker(Context context, AttributeSet attrs) {
super(context, attrs);
this.initialize(context, attrs);
}
public NumberPicker(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
private void initialize(Context context, AttributeSet attrs) {
// set layout view
LayoutInflater.from(context).inflate(R.layout.number_picker_layout, this, true);
// init ui components
this.minusButton = (Button) findViewById(R.id.decrement);
this.plusButton = (Button) findViewById(R.id.increment);
this.editText = (EditText) findViewById(R.id.display);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_INC:
inc(msg.arg1);
return;
case MSG_DEC:
dec(msg.arg1);
return;
}
super.handleMessage(msg);
}
};
minusButton.setOnTouchListener(this);
minusButton.setOnKeyListener(this);
minusButton.setOnClickListener(this);
plusButton.setOnTouchListener(this);
plusButton.setOnKeyListener(this);
plusButton.setOnClickListener(this);
}
public void removeTextChangedListener(TextWatcher textWatcher) {
editText.removeTextChangedListener(textWatcher);
}
public void addTextChangedListener(TextWatcher textWatcher) {
editText.addTextChangedListener(textWatcher);
}
public void setParams(Double initValue, Double minValue, Double maxValue, Double step, NumberFormat formater, boolean allowZero, TextWatcher textWatcher) {
setParams(initValue, minValue, maxValue, step, formater, allowZero);
editText.addTextChangedListener(textWatcher);
}
public void setParams(Double initValue, Double minValue, Double maxValue, Double step, NumberFormat formater, boolean allowZero) {
this.value = initValue;
this.minValue = minValue;
this.maxValue = maxValue;
this.step = step;
this.formater = formater;
this.allowZero = allowZero;
updateEditText();
}
public void setValue(Double value) {
this.value = value;
updateEditText();
}
public Double getValue() {
return value;
}
public String getText() {
return editText.getText().toString();
}
public void setStep(Double step) {
this.step = step;
}
private void inc(int multiplier) {
value += step * multiplier;
if (value > maxValue) {
value = maxValue;
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.youareonallowedlimit));
stopUpdating();
}
updateEditText();
}
private void dec( int multiplier) {
value -= step * multiplier;
if (value < minValue) {
value = minValue;
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.youareonallowedlimit));
stopUpdating();
}
updateEditText();
}
private void updateEditText() {
if (value == 0d && !allowZero)
editText.setText("");
else
editText.setText(formater.format(value));
}
private void startUpdating(boolean inc) {
if (mUpdater != null) {
log.debug("Another executor is still active");
return;
}
mUpdater = Executors.newSingleThreadScheduledExecutor();
mUpdater.scheduleAtFixedRate(new UpdateCounterTask(inc), 200, 200,
TimeUnit.MILLISECONDS);
}
private void stopUpdating() {
if (mUpdater != null) {
mUpdater.shutdownNow();
mUpdater = null;
}
}
@Override
public void onClick(View v) {
if (mUpdater == null) {
if (v == plusButton) {
inc(1);
} else {
dec(1);
}
}
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
boolean isKeyOfInterest = keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER;
boolean isReleased = event.getAction() == KeyEvent.ACTION_UP;
boolean isPressed = event.getAction() == KeyEvent.ACTION_DOWN
&& event.getAction() != KeyEvent.ACTION_MULTIPLE;
if (isKeyOfInterest && isReleased) {
stopUpdating();
} else if (isKeyOfInterest && isPressed) {
startUpdating(v == plusButton);
}
return false;
}
@Override
public boolean onTouch(View v, MotionEvent event) {
boolean isReleased = event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL;
boolean isPressed = event.getAction() == MotionEvent.ACTION_DOWN;
if (isReleased) {
stopUpdating();
} else if (isPressed) {
startUpdating(v == plusButton);
}
return false;
}
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#505050"/>
<stroke android:width="1dp" android:color="@color/colorLightGray"/>
<corners android:radius="4dp" />
</shape>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
<item android:bottom="0.5dp">
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="@color/colorLightGray" />
<solid android:color="@android:color/white" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="130dp"
android:layout_height="40dp"
android:orientation="horizontal"
android:background="@drawable/background_darkgray">
<Button
android:id="@+id/decrement"
android:layout_width="30dp"
android:layout_height="match_parent"
android:padding="0dp"
android:textColor="@color/mdtp_white"
android:background="@null"
android:textStyle="bold"
android:text="—"/>
<EditText
android:id="@+id/display"
android:layout_width="70dp"
android:background="@drawable/border_gray"
android:layout_height="match_parent"
android:text="1"
android:textColor="@android:color/black"
android:inputType="number"
android:gravity="center"
android:imeOptions="actionDone"
/>
<Button
android:id="@+id/increment"
android:layout_width="30dp"
android:layout_height="match_parent"
android:padding="0dp"
android:textSize="25sp"
android:textColor="@color/mdtp_white"
android:background="@null"
android:text="+"/>
</LinearLayout>

View file

@ -29,67 +29,24 @@
android:textAppearance="?android:attr/textAppearanceLarge" /> android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView <TextView
android:id="@+id/overview_calibration_units"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:padding="10dp" android:layout_marginBottom="10dp"
android:id="@+id/overview_calibration_units"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout <info.nightscout.utils.NumberPicker
android:layout_width="wrap_content" android:id="@+id/overview_calibration_bg"
android:layout_height="wrap_content" android:layout_width="130dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:orientation="horizontal"> android:layout_marginBottom="20dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
<ImageView <include layout="@layout/mdtp_done_button" />
android:id="@+id/overview_calibration_bg_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/overview_calibration_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/overview_calibration_bg_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
</LinearLayout>
<Button
android:id="@+id/overview_calibration_okbutton"
style="?android:attr/buttonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="OK"
android:textSize="20sp"
android:layout_marginTop="30dp" />
</LinearLayout> </LinearLayout>

View file

@ -5,142 +5,64 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment"> tools:context="info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog">
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp"> android:padding="10dp">
<RelativeLayout <TextView
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/bolus"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true" android:layout_gravity="center_horizontal"
android:text="@string/treatments_newtreatment_insulinamount_label" android:layout_marginBottom="5dp"
android:textAppearance="@android:style/TextAppearance.Material.Small" android:layout_marginTop="15dp"
android:textStyle="bold" /> android:text="@string/treatments_newtreatment_insulinamount_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<LinearLayout <info.nightscout.utils.NumberPicker
android:layout_width="wrap_content" android:id="@+id/treatments_newtreatment_insulinamount"
android:layout_height="wrap_content" android:layout_width="130dp"
android:layout_centerInParent="true" android:layout_height="40dp"
android:layout_marginTop="50dp" android:layout_gravity="end"
android:orientation="horizontal"> android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
<ImageView <TextView
android:id="@+id/treatments_newtreatment_insulinamount_minus" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
android:layout_gravity="center" android:layout_marginBottom="5dp"
android:background="@drawable/circle" android:layout_marginTop="15dp"
android:backgroundTint="#ffffff" android:text="@string/treatments_newtreatment_carbsamount_label"
android:src="@drawable/ic_action_minus" android:textAppearance="@android:style/TextAppearance.Material.Small"
android:tint="#ffffff" /> android:textStyle="bold" />
<EditText <info.nightscout.utils.NumberPicker
android:id="@+id/treatments_newtreatment_insulinamount" android:id="@+id/treatments_newtreatment_carbsamount"
android:layout_width="wrap_content" android:layout_width="130dp"
android:layout_height="wrap_content" android:layout_height="40dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:gravity="center_horizontal" android:layout_marginBottom="15dp" />
android:inputType="numberDecimal"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_newtreatment_insulinamount_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="5dp"
android:text="@string/treatments_newtreatment_carbsamount_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/treatments_newtreatment_carbsamount_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/treatments_newtreatment_carbsamount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_newtreatment_carbsamount_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
</LinearLayout>
</RelativeLayout>
<include layout="@layout/mdtp_done_button" /> <include layout="@layout/mdtp_done_button" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</FrameLayout> </FrameLayout>

View file

@ -26,38 +26,13 @@
android:width="120dp" android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:text="@string/treatments_wizard_bg_label" android:text="@string/treatments_wizard_bg_label"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<ImageView <info.nightscout.utils.NumberPicker
android:id="@+id/treatments_wizard_bginput_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/treatments_wizard_bginput" android:id="@+id/treatments_wizard_bginput"
android:layout_width="wrap_content" android:layout_width="130dp"
android:layout_height="wrap_content" android:layout_height="40dp" />
android:layout_gravity="center_horizontal"
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_wizard_bginput_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<TextView <TextView
android:id="@+id/treatments_wizard_bgunits" android:id="@+id/treatments_wizard_bgunits"
@ -65,7 +40,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:gravity="left" android:gravity="left"
android:minWidth="40dp" android:minWidth="45dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="mg/dl" android:text="mg/dl"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
@ -84,40 +59,15 @@
android:width="120dp" android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:text="@string/treatments_wizard_carbs_label" android:text="@string/treatments_wizard_carbs_label"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<ImageView <info.nightscout.utils.NumberPicker
android:id="@+id/treatments_wizard_carbsinput_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/treatments_wizard_carbsinput" android:id="@+id/treatments_wizard_carbsinput"
android:layout_width="wrap_content" android:layout_width="130dp"
android:layout_height="wrap_content" android:layout_height="40dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal" />
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="200dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_wizard_carbsinput_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -143,47 +93,21 @@
android:width="120dp" android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:text="@string/treatments_wizard_correction_label" android:text="@string/treatments_wizard_correction_label"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<ImageView <info.nightscout.utils.NumberPicker
android:id="@+id/treatments_wizard_correctioninput_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/treatments_wizard_correctioninput" android:id="@+id/treatments_wizard_correctioninput"
android:layout_width="wrap_content" android:layout_width="130dp"
android:layout_height="wrap_content" android:layout_height="40dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal" />
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberSigned|numberDecimal"
android:minWidth="200dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView <TextView
android:id="@+id/treatments_wizard_correctioninput_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:gravity="left" android:gravity="left"
android:minWidth="40dp" android:minWidth="45dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="@string/treatments_wizard_unit_label" android:text="@string/treatments_wizard_unit_label"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
@ -194,57 +118,30 @@
android:id="@+id/treatments_wizard_carbtime_layout" android:id="@+id/treatments_wizard_carbtime_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp" android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:text="@string/careportal_newnstreatment_carbtime_label" android:text="@string/careportal_newnstreatment_carbtime_label"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<ImageView <info.nightscout.utils.NumberPicker
android:id="@+id/treatments_wizard_carbtime_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/treatments_wizard_carbtimeinput" android:id="@+id/treatments_wizard_carbtimeinput"
android:layout_width="wrap_content" android:layout_width="130dp"
android:layout_height="wrap_content" android:layout_height="40dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal" />
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="200dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_wizard_carbtime_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:gravity="left" android:gravity="left"
android:minWidth="40dp" android:minWidth="45dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="min" android:text="min"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
@ -263,7 +160,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:padding="10dp"
android:text="@string/careportal_newnstreatment_profile_label" android:text="@string/careportal_newnstreatment_profile_label"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<Spinner <Spinner
android:id="@+id/treatments_wizard_profile" android:id="@+id/treatments_wizard_profile"
@ -284,32 +182,31 @@
</LinearLayout> </LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="center"
android:layout_marginLeft="20dp" android:orientation="horizontal">
android:layout_marginRight="20dp"
android:orientation="horizontal"
android:padding="10dp">
<Button <TextView
android:id="@+id/treatments_wizard_deliverButton" android:id="@+id/treatments_wizard_total"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:background="@drawable/background_darkgray"
android:padding="10dp" android:paddingLeft="10dp"
android:text="SEND TO PUMP" android:paddingRight="10dp"
android:textAllCaps="false" android:text="2.35U 28g"
android:textSize="20sp" /> android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout> </LinearLayout>
<include layout="@layout/mdtp_done_button" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="-20dp"
android:orientation="horizontal"> android:orientation="horizontal">
<CheckBox <CheckBox
@ -589,45 +486,5 @@
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
android:height="30dp"
android:gravity="center_vertical"
android:text="@string/treatments_wizard_total_label"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/accent_material_light"
android:textStyle="bold" />
<TextView
android:id="@+id/treatments_wizard_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/treatments_wizard_totalinsulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"
android:gravity="center_vertical|end"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/accent_material_light"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -16,6 +16,7 @@
<color name="tempbasal">#C803A9F4</color> <color name="tempbasal">#C803A9F4</color>
<color name="graphgrid">#757575</color> <color name="graphgrid">#757575</color>
<color name="updating">#50ffffff</color> <color name="updating">#50ffffff</color>
<color name="colorLightGray">#d8d8d8</color>
<color name="defaultbackground">#424242</color> <color name="defaultbackground">#424242</color>

View file

@ -39,8 +39,8 @@
<string name="tempbasals_netinsulin_label_string">Ins:</string> <string name="tempbasals_netinsulin_label_string">Ins:</string>
<string name="tempbasals_iob_label_string">IOB:</string> <string name="tempbasals_iob_label_string">IOB:</string>
<string name="tempbasals_iobtotal_label_string">Total IOB:</string> <string name="tempbasals_iobtotal_label_string">Total IOB:</string>
<string name="treatments_newtreatment_insulinamount_label">Insulin amount</string> <string name="treatments_newtreatment_insulinamount_label">Insulin</string>
<string name="treatments_newtreatment_carbsamount_label">Carbs amount</string> <string name="treatments_newtreatment_carbsamount_label">Carbs</string>
<string name="treatments_wizard_bg_label">BG</string> <string name="treatments_wizard_bg_label">BG</string>
<string name="treatments_wizard_carbs_label">Carbs</string> <string name="treatments_wizard_carbs_label">Carbs</string>
<string name="treatments_wizard_correction_label">Corr</string> <string name="treatments_wizard_correction_label">Corr</string>
@ -483,7 +483,7 @@
<string name="copied_to_clipboard">Copied to clipboard</string> <string name="copied_to_clipboard">Copied to clipboard</string>
<string name="nav_show_logcat">Show log</string> <string name="nav_show_logcat">Show log</string>
<string name="overview_calibration">Calibration</string> <string name="overview_calibration">Calibration</string>
<string name="overview_calibration_bg_label">Calibration BG</string> <string name="overview_calibration_bg_label">Calibration</string>
<string name="send_calibration" formatted="false">Send calibration %.1f to xDrip?</string> <string name="send_calibration" formatted="false">Send calibration %.1f to xDrip?</string>
<string name="xdripnotinstalled">xDrip+ not installed</string> <string name="xdripnotinstalled">xDrip+ not installed</string>
<string name="calibrationsent">Calibration sent to xDrip</string> <string name="calibrationsent">Calibration sent to xDrip</string>