Merge branch 'dev' of https://github.com/MilosKozak/AndroidAPS into dev
This commit is contained in:
commit
e4d55473a1
|
@ -44,7 +44,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1500
|
||||
version "1.5"
|
||||
version "1.5a"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
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);
|
||||
running = true;
|
||||
if (bolusEnded) dismiss();
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.crashlytics.android.answers.Answers;
|
||||
|
@ -25,17 +24,15 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
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.XdripCalibrations;
|
||||
|
||||
public class CalibrationDialog extends DialogFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(CalibrationDialog.class);
|
||||
|
||||
Button okButton;
|
||||
PlusMinusEditText bgText;
|
||||
NumberPicker bgNumber;
|
||||
TextView unitsView;
|
||||
TextView bgView;
|
||||
|
||||
Context context;
|
||||
|
||||
|
@ -57,20 +54,21 @@ 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);
|
||||
|
||||
if (units.equals(Constants.MMOL))
|
||||
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);
|
||||
bgNumber = (NumberPicker) view.findViewById(R.id.overview_calibration_bg);
|
||||
|
||||
if (units.equals(Constants.MMOL))
|
||||
bgNumber.setParams(bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
|
||||
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.setText(units);
|
||||
bgView = (TextView) view.findViewById(R.id.overview_calibration_bg);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -78,13 +76,15 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.overview_calibration_okbutton:
|
||||
final Double bg = SafeParse.stringToDouble(this.bgView.getText().toString());
|
||||
;
|
||||
case R.id.ok:
|
||||
final Double bg = SafeParse.stringToDouble(bgNumber.getText());
|
||||
XdripCalibrations.confirmAndSendCalibration(bg, context);
|
||||
dismiss();
|
||||
Answers.getInstance().logCustom(new CustomEvent("Calibration"));
|
||||
break;
|
||||
case R.id.cancel:
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,13 +29,14 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
|||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.utils.NumberPicker;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
||||
|
||||
PlusMinusEditText editCarbs;
|
||||
PlusMinusEditText editInsulin;
|
||||
NumberPicker editCarbs;
|
||||
NumberPicker editInsulin;
|
||||
|
||||
Handler mHandler;
|
||||
public static HandlerThread mHandlerThread;
|
||||
|
@ -49,7 +50,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
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.cancel).setOnClickListener(this);
|
||||
|
@ -60,19 +61,15 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||
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);
|
||||
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);
|
||||
editCarbs = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_carbsamount);
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (getDialog() != null)
|
||||
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
|
|
|
@ -60,6 +60,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui
|
|||
import info.nightscout.utils.BolusWizard;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NumberPicker;
|
||||
import info.nightscout.utils.OKDialog;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
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 {
|
||||
private static Logger log = LoggerFactory.getLogger(WizardDialog.class);
|
||||
|
||||
Button wizardDialogDeliverButton;
|
||||
TextView correctionInput;
|
||||
TextView carbsInput;
|
||||
TextView bgInput;
|
||||
Button okButton;
|
||||
TextView bg;
|
||||
TextView bgInsulin;
|
||||
TextView bgUnits;
|
||||
|
@ -85,8 +83,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
CheckBox basalIobCheckbox;
|
||||
TextView correctionInsulin;
|
||||
TextView total;
|
||||
TextView totalInsulin;
|
||||
EditText carbTimeEdit;
|
||||
Spinner profileSpinner;
|
||||
CheckBox superbolusCheckbox;
|
||||
TextView superbolus;
|
||||
|
@ -99,10 +95,10 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
TextView cob;
|
||||
TextView cobInsulin;
|
||||
|
||||
PlusMinusEditText editBg;
|
||||
PlusMinusEditText editCarbs;
|
||||
PlusMinusEditText editCorr;
|
||||
PlusMinusEditText editCarbTime;
|
||||
NumberPicker editBg;
|
||||
NumberPicker editCarbs;
|
||||
NumberPicker editCorr;
|
||||
NumberPicker editCarbTime;
|
||||
|
||||
Integer calculatedCarbs = 0;
|
||||
Double calculatedTotalInsulin = 0d;
|
||||
|
@ -129,9 +125,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (getDialog() != null)
|
||||
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
super.onPause();
|
||||
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().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
|
||||
wizardDialogDeliverButton = (Button) view.findViewById(R.id.treatments_wizard_deliverButton);
|
||||
wizardDialogDeliverButton.setOnClickListener(this);
|
||||
okButton = (Button) view.findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||
|
||||
bg = (TextView) view.findViewById(R.id.treatments_wizard_bg);
|
||||
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);
|
||||
correctionInsulin = (TextView) view.findViewById(R.id.treatments_wizard_correctioninsulin);
|
||||
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);
|
||||
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.setOnItemSelectedListener(this);
|
||||
|
||||
correctionInput = (TextView) view.findViewById(R.id.treatments_wizard_correctioninput);
|
||||
carbsInput = (TextView) view.findViewById(R.id.treatments_wizard_carbsinput);
|
||||
bgInput = (TextView) view.findViewById(R.id.treatments_wizard_bginput);
|
||||
correctionInput.addTextChangedListener(textWatcher);
|
||||
carbsInput.addTextChangedListener(textWatcher);
|
||||
bgInput.addTextChangedListener(textWatcher);
|
||||
editCarbTime = (NumberPicker) view.findViewById(R.id.treatments_wizard_carbtimeinput);
|
||||
editCorr = (NumberPicker) view.findViewById(R.id.treatments_wizard_correctioninput);
|
||||
editCarbs = (NumberPicker) view.findViewById(R.id.treatments_wizard_carbsinput);
|
||||
editBg = (NumberPicker) view.findViewById(R.id.treatments_wizard_bginput);
|
||||
|
||||
superbolusCheckbox.setVisibility(SP.getBoolean(R.string.key_usesuperbolus, false) ? View.VISIBLE : View.GONE);
|
||||
|
||||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
editBg.setParams(0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false, textWatcher);
|
||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||
editCorr.setParams(0d, -maxCorrection, maxCorrection, 0.05d, new DecimalFormat("0.00"), false, textWatcher);
|
||||
editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
||||
initDialog();
|
||||
|
||||
return view;
|
||||
|
@ -265,19 +256,19 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
calculateInsulin();
|
||||
wizardDialogDeliverButton.setVisibility(View.VISIBLE);
|
||||
okButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.noprofileselected));
|
||||
wizardDialogDeliverButton.setVisibility(View.GONE);
|
||||
okButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.treatments_wizard_deliverButton:
|
||||
case R.id.ok:
|
||||
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
|
||||
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
|
||||
String confirmMessage = getString(R.string.entertreatmentquestion);
|
||||
|
@ -299,8 +290,8 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
|
||||
final Double finalInsulinAfterConstraints = insulinAfterConstraints;
|
||||
final Integer finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||
final Double bg = SafeParse.stringToDouble(bgInput.getText().toString());
|
||||
final int carbTime = SafeParse.stringToInt(carbTimeEdit.getText().toString());
|
||||
final Double bg = SafeParse.stringToDouble(editBg.getText());
|
||||
final int carbTime = SafeParse.stringToInt(editCarbTime.getText());
|
||||
final boolean useSuperBolus = superbolusCheckbox.isChecked();
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
|
@ -350,6 +341,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
dismiss();
|
||||
}
|
||||
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));
|
||||
bgInsulin.setText(DecimalFormatter.to2Decimal(bgDiff / sens) + "U");
|
||||
bgInput.removeTextChangedListener(textWatcher);
|
||||
editBg.removeTextChangedListener(textWatcher);
|
||||
//bgInput.setText(lastBg.valueToUnitsToString(units));
|
||||
editBg.setValue(lastBg.valueToUnits(units));
|
||||
bgInput.addTextChangedListener(textWatcher);
|
||||
editBg.addTextChangedListener(textWatcher);
|
||||
} else {
|
||||
bg.setText("");
|
||||
bgInsulin.setText("");
|
||||
bgInput.removeTextChangedListener(textWatcher);
|
||||
editBg.removeTextChangedListener(textWatcher);
|
||||
//bgInput.setText("");
|
||||
editBg.setValue(0d);
|
||||
bgInput.addTextChangedListener(textWatcher);
|
||||
editBg.addTextChangedListener(textWatcher);
|
||||
}
|
||||
|
||||
// IOB calculation
|
||||
|
@ -418,9 +412,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
bolusIobInsulin.setText(DecimalFormatter.to2Decimal(-bolusIob.iob) + "U");
|
||||
basalIobInsulin.setText(DecimalFormatter.to2Decimal(-basalIob.basaliob) + "U");
|
||||
|
||||
totalInsulin.setText("");
|
||||
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE);
|
||||
|
||||
// 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))) {
|
||||
cobLayout.setVisibility(View.VISIBLE);
|
||||
|
@ -429,6 +420,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
cobLayout.setVisibility(View.GONE);
|
||||
cobAvailable = false;
|
||||
}
|
||||
calculateInsulin();
|
||||
}
|
||||
|
||||
private void calculateInsulin() {
|
||||
|
@ -439,23 +431,23 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
Profile specificProfile = profile.getSpecificProfile(selectedAlternativeProfile);
|
||||
|
||||
// Entered values
|
||||
Double c_bg = SafeParse.stringToDouble(bgInput.getText().toString());
|
||||
Integer c_carbs = SafeParse.stringToInt(carbsInput.getText().toString());
|
||||
Double c_correction = SafeParse.stringToDouble(correctionInput.getText().toString());
|
||||
Double c_bg = SafeParse.stringToDouble(editBg.getText());
|
||||
Integer c_carbs = SafeParse.stringToInt(editCarbs.getText());
|
||||
Double c_correction = SafeParse.stringToDouble(editCorr.getText());
|
||||
Double corrAfterConstraint = MainApp.getConfigBuilder().applyBolusConstraints(c_correction);
|
||||
if (c_correction - corrAfterConstraint != 0) { // c_correction != corrAfterConstraint doesn't work
|
||||
correctionInput.removeTextChangedListener(textWatcher);
|
||||
correctionInput.setText("");
|
||||
correctionInput.addTextChangedListener(textWatcher);
|
||||
editCorr.removeTextChangedListener(textWatcher);
|
||||
editCorr.setValue(0d);
|
||||
editCorr.addTextChangedListener(textWatcher);
|
||||
//wizardDialogDeliverButton.setVisibility(Button.GONE);
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.bolusconstraintapplied));
|
||||
return;
|
||||
}
|
||||
Integer carbsAfterConstraint = MainApp.getConfigBuilder().applyCarbsConstraints(c_carbs);
|
||||
if (c_carbs - carbsAfterConstraint != 0) {
|
||||
carbsInput.removeTextChangedListener(textWatcher);
|
||||
carbsInput.setText("");
|
||||
carbsInput.addTextChangedListener(textWatcher);
|
||||
editCarbs.removeTextChangedListener(textWatcher);
|
||||
editCarbs.setValue(0d);
|
||||
editCarbs.addTextChangedListener(textWatcher);
|
||||
//wizardDialogDeliverButton.setVisibility(Button.GONE);
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.carbsconstraintapplied));
|
||||
return;
|
||||
|
@ -489,14 +481,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
correctionInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromCorrection) + "U");
|
||||
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;
|
||||
|
||||
// Superbolus
|
||||
|
@ -531,10 +515,11 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) {
|
||||
String insulinText = calculatedTotalInsulin > 0d ? (DecimalFormatter.to2Decimal(calculatedTotalInsulin) + "U") : "";
|
||||
String carbsText = calculatedCarbs > 0d ? (DecimalFormatter.to0Decimal(calculatedCarbs) + "g") : "";
|
||||
wizardDialogDeliverButton.setText(getString(R.string.send) + " " + insulinText + " " + carbsText);
|
||||
wizardDialogDeliverButton.setVisibility(Button.VISIBLE);
|
||||
total.setText(getString(R.string.send) + " " + insulinText + " " + carbsText);
|
||||
okButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
wizardDialogDeliverButton.setVisibility(Button.INVISIBLE);
|
||||
total.setText(getString(R.string.missing) + " " + DecimalFormatter.to0Decimal(wizard.carbsEquivalent) + "g");
|
||||
okButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
boluscalcJSON = new JSONObject();
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
|
@ -155,7 +156,7 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
|||
|
||||
@Override
|
||||
public String getUnits() {
|
||||
return profile.getUnits();
|
||||
return profile != null ? profile.getUnits() : Constants.MGDL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
248
app/src/main/java/info/nightscout/utils/NumberPicker.java
Normal file
248
app/src/main/java/info/nightscout/utils/NumberPicker.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
9
app/src/main/res/drawable-hdpi/background_darkgray.xml
Normal file
9
app/src/main/res/drawable-hdpi/background_darkgray.xml
Normal 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>
|
18
app/src/main/res/drawable-hdpi/border_gray.xml
Normal file
18
app/src/main/res/drawable-hdpi/border_gray.xml
Normal 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>
|
||||
|
39
app/src/main/res/layout/number_picker_layout.xml
Normal file
39
app/src/main/res/layout/number_picker_layout.xml
Normal 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>
|
|
@ -29,67 +29,24 @@
|
|||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_calibration_units"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="10dp"
|
||||
android:id="@+id/overview_calibration_units"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/overview_calibration_bg"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
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" />
|
||||
<include layout="@layout/mdtp_done_button" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -5,142 +5,64 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/bolus"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:text="@string/treatments_newtreatment_insulinamount_label"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/treatments_newtreatment_insulinamount_label"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:orientation="horizontal">
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/treatments_newtreatment_insulinamount"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/treatments_newtreatment_insulinamount_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" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/treatments_newtreatment_carbsamount_label"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/treatments_newtreatment_insulinamount"
|
||||
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_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>
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/treatments_newtreatment_carbsamount"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="15dp" />
|
||||
|
||||
<include layout="@layout/mdtp_done_button" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -26,38 +26,13 @@
|
|||
android:width="120dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/treatments_wizard_bg_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/treatments_wizard_bginput"
|
||||
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: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" />
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/treatments_wizard_bgunits"
|
||||
|
@ -65,7 +40,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:minWidth="45dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="mg/dl"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
@ -84,40 +59,15 @@
|
|||
android:width="120dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/treatments_wizard_carbs_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/treatments_wizard_carbsinput"
|
||||
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="200dp"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<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
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -143,47 +93,21 @@
|
|||
android:width="120dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/treatments_wizard_correction_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/treatments_wizard_correctioninput"
|
||||
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="numberSigned|numberDecimal"
|
||||
android:minWidth="200dp"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:minWidth="45dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/treatments_wizard_unit_label"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
@ -194,57 +118,30 @@
|
|||
android:id="@+id/treatments_wizard_carbtime_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="120dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_carbtime_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/treatments_wizard_carbtimeinput"
|
||||
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="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" />
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:minWidth="45dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="min"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
@ -263,7 +160,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_profile_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/treatments_wizard_profile"
|
||||
|
@ -284,32 +182,31 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/treatments_wizard_deliverButton"
|
||||
style="?android:attr/buttonStyle"
|
||||
<TextView
|
||||
android:id="@+id/treatments_wizard_total"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="SEND TO PUMP"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="20sp" />
|
||||
android:background="@drawable/background_darkgray"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="2.35U 28g"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/mdtp_done_button" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
|
@ -589,45 +486,5 @@
|
|||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</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>
|
||||
</ScrollView>
|
|
@ -16,6 +16,7 @@
|
|||
<color name="tempbasal">#C803A9F4</color>
|
||||
<color name="graphgrid">#757575</color>
|
||||
<color name="updating">#50ffffff</color>
|
||||
<color name="colorLightGray">#d8d8d8</color>
|
||||
|
||||
<color name="defaultbackground">#424242</color>
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
<string name="tempbasals_netinsulin_label_string">Ins:</string>
|
||||
<string name="tempbasals_iob_label_string">IOB:</string>
|
||||
<string name="tempbasals_iobtotal_label_string">Total IOB:</string>
|
||||
<string name="treatments_newtreatment_insulinamount_label">Insulin amount</string>
|
||||
<string name="treatments_newtreatment_carbsamount_label">Carbs amount</string>
|
||||
<string name="treatments_newtreatment_insulinamount_label">Insulin</string>
|
||||
<string name="treatments_newtreatment_carbsamount_label">Carbs</string>
|
||||
<string name="treatments_wizard_bg_label">BG</string>
|
||||
<string name="treatments_wizard_carbs_label">Carbs</string>
|
||||
<string name="treatments_wizard_correction_label">Corr</string>
|
||||
|
@ -483,7 +483,7 @@
|
|||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||
<string name="nav_show_logcat">Show log</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="xdripnotinstalled">xDrip+ not installed</string>
|
||||
<string name="calibrationsent">Calibration sent to xDrip</string>
|
||||
|
|
Loading…
Reference in a new issue