diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java
index 0b8b263262..89e9a5308e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java
@@ -103,7 +103,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
if (insulin > maxInsulin) {
editInsulin.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.bolusconstraintapplied));
+ ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.bolusconstraintapplied));
}
}
@@ -234,14 +234,14 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
String confirmMessage = "";
if (insulin > 0) {
- confirmMessage += getString(R.string.bolus) + ": " + "" + insulinAfterConstraints + "U" + "";
+ confirmMessage += MainApp.gs(R.string.bolus) + ": " + "" + insulinAfterConstraints + "U" + "";
if (recordOnlyCheckbox.isChecked()) {
- confirmMessage += "
" + "Bolus will be recorded only";
+ confirmMessage += "
" + MainApp.gs(R.string.bolusrecordedonly) + "";
}
}
if (!insulinAfterConstraints.equals(insulin))
- confirmMessage += "
" + getString(R.string.bolusconstraintapplied) + "";
+ confirmMessage += "
" + MainApp.gs(R.string.bolusconstraintapplied) + "";
double prefTTDuration = SP.getDouble(R.string.key_eatingsoon_duration, 45d);
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 45d;
double prefTT = SP.getDouble(R.string.key_eatingsoon_target, 80d);
@@ -270,11 +270,11 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
final Context context = getContext();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(this.getContext().getString(R.string.confirmation));
+ builder.setTitle(MainApp.gs(R.string.confirmation));
if (confirmMessage.startsWith("
"))
confirmMessage = confirmMessage.substring("
".length());
builder.setMessage(Html.fromHtml(confirmMessage));
- builder.setPositiveButton(getString(R.string.ok), (dialog, id) -> {
+ builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
synchronized (builder) {
if (accepted) {
log.debug("guarding: already accepted");
@@ -317,7 +317,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
- i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
@@ -327,7 +327,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
}
}
});
- builder.setNegativeButton(getString(R.string.cancel), null);
+ builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
builder.show();
dismiss();
} catch (Exception e) {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java
index 2fd897b3aa..d17dfdd0b8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java
@@ -15,6 +15,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
+import android.widget.CheckBox;
import com.crashlytics.android.answers.CustomEvent;
@@ -50,6 +51,8 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
private boolean accepted;
private boolean okClicked;
+ private CheckBox recordOnlyCheckbox;
+
public NewTreatmentDialog() {
}
@@ -72,12 +75,12 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
Integer carbs = SafeParse.stringToInt(editCarbs.getText());
if (carbs > maxCarbs) {
editCarbs.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.carbsconstraintapplied));
+ ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.carbsconstraintapplied));
}
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
if (insulin > maxInsulin) {
editInsulin.setValue(0d);
- ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.bolusconstraintapplied));
+ ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.bolusconstraintapplied));
}
}
@@ -101,6 +104,8 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
+ recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newtreatment_record_only);
+
setCancelable(true);
getDialog().setCanceledOnTouchOutside(false);
return view;
@@ -121,15 +126,21 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
Double insulin = SafeParse.stringToDouble(editInsulin.getText());
final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
- String confirmMessage = getString(R.string.entertreatmentquestion) + "
";
+ String confirmMessage = MainApp.gs(R.string.entertreatmentquestion) + "
";
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(insulin);
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(carbs);
- confirmMessage += getString(R.string.bolus) + ": " + "" + insulinAfterConstraints + "U" + "";
- confirmMessage += "
" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
+ if (insulin > 0) {
+ confirmMessage += MainApp.gs(R.string.bolus) + ": " + "" + insulinAfterConstraints + "U" + "";
+ if (recordOnlyCheckbox.isChecked()) {
+ confirmMessage += "
" + MainApp.gs(R.string.bolusrecordedonly) + "";
+ }
+ }
+ if (carbsAfterConstraints > 0)
+ confirmMessage += "
" + MainApp.gs(R.string.carbs) + ": " + carbsAfterConstraints + "g";
if (insulinAfterConstraints - insulin != 0 || !Objects.equals(carbsAfterConstraints, carbs))
- confirmMessage += "
" + getString(R.string.constraintapllied);
+ confirmMessage += "
" + MainApp.gs(R.string.constraintapllied);
final double finalInsulinAfterConstraints = insulinAfterConstraints;
@@ -138,9 +149,9 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
final Context context = getContext();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(this.getContext().getString(R.string.confirmation));
+ builder.setTitle(MainApp.gs(R.string.confirmation));
builder.setMessage(Html.fromHtml(confirmMessage));
- builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
+ builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
synchronized (builder) {
if (accepted) {
@@ -158,7 +169,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
detailedBolusInfo.context = context;
detailedBolusInfo.source = Source.USER;
- if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
+ if (!(recordOnlyCheckbox.isChecked() && (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo))) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
@@ -166,7 +177,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
- i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
+ i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
@@ -180,9 +191,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
}
}
});
- builder.setNegativeButton(
-
- getString(R.string.cancel), null);
+ builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
builder.show();
dismiss();
diff --git a/app/src/main/res/layout/overview_newinsulin_dialog.xml b/app/src/main/res/layout/overview_newinsulin_dialog.xml
index 6f9f2d7882..c7df59fb05 100644
--- a/app/src/main/res/layout/overview_newinsulin_dialog.xml
+++ b/app/src/main/res/layout/overview_newinsulin_dialog.xml
@@ -23,12 +23,13 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/overview_insulin_label"
- android:textColor="@color/colorInsulinButton"
- android:textAppearance="?android:attr/textAppearanceLarge" />
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="@color/colorInsulinButton" />
@@ -48,8 +49,8 @@
+ android:layout_gravity="center_horizontal"
+ android:padding="5dp">
+ android:orientation="horizontal">
+
+
Nepouštět bolus, jen zaznamenat
Podkategorie
Kategorie
+ Bolus bude pouze zaznamenán
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 549e111a01..8a525261cc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -978,5 +978,6 @@
Don\'t bolus, record only
Category
Subcategory
+ Bolus will be recorded only