From 401b4c170fb3bc15017fba9e9fe4acd081ff9400 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 7 Dec 2019 23:14:36 +0100 Subject: [PATCH] replacing getRessources.getString with aaps.gs in java files --- .../interaction/actions/BolusActivity.java | 5 +++-- .../interaction/actions/CPPActivity.java | 5 +++-- .../interaction/actions/ECarbActivity.java | 7 ++++--- .../interaction/actions/FillActivity.java | 3 ++- .../interaction/actions/TempTargetActivity.java | 9 +++++---- .../interaction/actions/WizardActivity.java | 5 +++-- .../interaction/menus/StatusMenuActivity.java | 17 +++++++++-------- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java index 138b05cb06..95dea79d47 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/BolusActivity.java @@ -16,6 +16,7 @@ import info.nightscout.androidaps.R; import java.text.DecimalFormat; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.SafeParse; @@ -71,7 +72,7 @@ public class BolusActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editInsulin.editText.getText().toString()); } editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_insulin)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_insulin)); container.addView(view); return view; } else if(col == 1){ @@ -81,7 +82,7 @@ public class BolusActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editCarbs.editText.getText().toString()); } editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_carbs)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_carbs)); container.addView(view); return view; } else { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java index 285f1521d0..b9626b47da 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/CPPActivity.java @@ -14,6 +14,7 @@ import android.widget.ImageView; import java.text.DecimalFormat; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.SafeParse; @@ -83,7 +84,7 @@ public class CPPActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editTimeshift.editText.getText().toString()); } editTimeshift = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 23d, 1d, new DecimalFormat("0"), true, true); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_timeshift)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_timeshift)); container.addView(view); return view; } else if(col == 1){ @@ -93,7 +94,7 @@ public class CPPActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editPercentage.editText.getText().toString()); } editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_percentage)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_percentage)); container.addView(view); return view; } else { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java index bd00f3ba15..cae69b34a5 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/ECarbActivity.java @@ -14,6 +14,7 @@ import android.widget.ImageView; import java.text.DecimalFormat; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.SafeParse; @@ -71,7 +72,7 @@ public class ECarbActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editCarbs.editText.getText().toString()); } editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_carbs)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_carbs)); container.addView(view); return view; } else if(col == 1){ @@ -81,7 +82,7 @@ public class ECarbActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editStartTime.editText.getText().toString()); } editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 15d, new DecimalFormat("0"), false); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_start_min)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_start_min)); container.addView(view); return view; } else if(col == 2){ @@ -91,7 +92,7 @@ public class ECarbActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editDuration.editText.getText().toString()); } editDuration = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 8d, 1d, new DecimalFormat("0"), false); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_duration_h)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_duration_h)); container.addView(view); return view; } else { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java index 3fb463b3c8..3f9eac6475 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/FillActivity.java @@ -16,6 +16,7 @@ import android.widget.TextView; import java.text.DecimalFormat; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.SafeParse; @@ -70,7 +71,7 @@ public class FillActivity extends ViewSelectorActivity { def = SafeParse.stringToDouble(editInsulin.editText.getText().toString()); } editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false); - setLabelToPlusMinusView(view, getResources().getString(R.string.action_insulin)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_insulin)); container.addView(view); return view; } else { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java index b23672b12f..885f1cd1ba 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/TempTargetActivity.java @@ -18,6 +18,7 @@ import android.widget.TextView; import java.text.DecimalFormat; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.SafeParse; @@ -85,7 +86,7 @@ public class TempTargetActivity extends ViewSelectorActivity { double def = SafeParse.stringToDouble(time.editText.getText().toString()); time = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 24 * 60d, 5d, new DecimalFormat("0"), false); } - setLabelToPlusMinusView(view, getResources().getString(R.string.action_duration)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_duration)); container.addView(view); return view; @@ -105,9 +106,9 @@ public class TempTargetActivity extends ViewSelectorActivity { lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false); } if(isSingleTarget){ - setLabelToPlusMinusView(view, getResources().getString(R.string.action_target)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_target)); } else { - setLabelToPlusMinusView(view, getResources().getString(R.string.action_low)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_low)); } container.addView(view); return view; @@ -126,7 +127,7 @@ public class TempTargetActivity extends ViewSelectorActivity { } highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false); } - setLabelToPlusMinusView(view, getResources().getString(R.string.action_high)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_high)); container.addView(view); return view; }else { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java index f2b4e3cc0b..a3a10ae03d 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/actions/WizardActivity.java @@ -17,6 +17,7 @@ import android.widget.TextView; import java.text.DecimalFormat; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.R; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; @@ -80,7 +81,7 @@ public class WizardActivity extends ViewSelectorActivity { editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false); } - setLabelToPlusMinusView(view, getResources().getString(R.string.action_carbs)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_carbs)); container.addView(view); return view; } else if(col == 1 && hasPercentage){ @@ -91,7 +92,7 @@ public class WizardActivity extends ViewSelectorActivity { double def = SafeParse.stringToDouble(editPercentage.editText.getText().toString()); editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false); } - setLabelToPlusMinusView(view, getResources().getString(R.string.action_percentage)); + setLabelToPlusMinusView(view, aaps.gs(R.string.action_percentage)); container.addView(view); return view; } else { diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java index 8aae40478e..8d9a78ec5e 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.java @@ -1,6 +1,7 @@ package info.nightscout.androidaps.interaction.menus; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.aaps; import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.interaction.utils.MenuListActivity; @@ -13,23 +14,23 @@ public class StatusMenuActivity extends MenuListActivity { @Override protected String[] getElements() { return new String[] { - getResources().getString(R.string.status_pump), - getResources().getString(R.string.status_loop), - getResources().getString(R.string.status_cpp), - getResources().getString(R.string.status_tdd)}; + aaps.gs(R.string.status_pump), + aaps.gs(R.string.status_loop), + aaps.gs(R.string.status_cpp), + aaps.gs(R.string.status_tdd)}; } @Override protected void doAction(String action) { - if (getResources().getString(R.string.status_pump).equals(action)) { + if (aaps.gs(R.string.status_pump).equals(action)) { ListenerService.initiateAction(this, "status pump"); - } else if (getResources().getString(R.string.status_loop).equals(action)) { + } else if (aaps.gs(R.string.status_loop).equals(action)) { ListenerService.initiateAction(this, "status loop"); - } else if (getResources().getString(R.string.status_cpp).equals(action)) { + } else if (aaps.gs(R.string.status_cpp).equals(action)) { ListenerService.initiateAction(this, "opencpp"); - } else if (getResources().getString(R.string.status_tdd).equals(action)) { + } else if (aaps.gs(R.string.status_tdd).equals(action)) { ListenerService.initiateAction(this, "tddstats"); } }