replacing getRessources.getString with aaps.gs in java files

This commit is contained in:
Philoul 2019-12-07 23:14:36 +01:00
parent d50f01af3d
commit 401b4c170f
7 changed files with 29 additions and 22 deletions

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse; import info.nightscout.androidaps.interaction.utils.SafeParse;
@ -71,7 +72,7 @@ public class BolusActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editInsulin.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else if(col == 1){ } else if(col == 1){
@ -81,7 +82,7 @@ public class BolusActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else { } else {

View file

@ -14,6 +14,7 @@ import android.widget.ImageView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse; import info.nightscout.androidaps.interaction.utils.SafeParse;
@ -83,7 +84,7 @@ public class CPPActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editTimeshift.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else if(col == 1){ } else if(col == 1){
@ -93,7 +94,7 @@ public class CPPActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editPercentage.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else { } else {

View file

@ -14,6 +14,7 @@ import android.widget.ImageView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse; import info.nightscout.androidaps.interaction.utils.SafeParse;
@ -71,7 +72,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else if(col == 1){ } else if(col == 1){
@ -81,7 +82,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editStartTime.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else if(col == 2){ } else if(col == 2){
@ -91,7 +92,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editDuration.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else { } else {

View file

@ -16,6 +16,7 @@ import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse; import info.nightscout.androidaps.interaction.utils.SafeParse;
@ -70,7 +71,7 @@ public class FillActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editInsulin.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else { } else {

View file

@ -18,6 +18,7 @@ import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; import info.nightscout.androidaps.interaction.utils.PlusMinusEditText;
import info.nightscout.androidaps.interaction.utils.SafeParse; import info.nightscout.androidaps.interaction.utils.SafeParse;
@ -85,7 +86,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
double def = SafeParse.stringToDouble(time.editText.getText().toString()); 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); 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); container.addView(view);
return 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); 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){ if(isSingleTarget){
setLabelToPlusMinusView(view, getResources().getString(R.string.action_target)); setLabelToPlusMinusView(view, aaps.gs(R.string.action_target));
} else { } else {
setLabelToPlusMinusView(view, getResources().getString(R.string.action_low)); setLabelToPlusMinusView(view, aaps.gs(R.string.action_low));
} }
container.addView(view); container.addView(view);
return 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); 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); container.addView(view);
return view; return view;
}else { }else {

View file

@ -17,6 +17,7 @@ import android.widget.TextView;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.utils.PlusMinusEditText; 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); 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); container.addView(view);
return view; return view;
} else if(col == 1 && hasPercentage){ } else if(col == 1 && hasPercentage){
@ -91,7 +92,7 @@ public class WizardActivity extends ViewSelectorActivity {
double def = SafeParse.stringToDouble(editPercentage.editText.getText().toString()); 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); 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); container.addView(view);
return view; return view;
} else { } else {

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.interaction.menus; package info.nightscout.androidaps.interaction.menus;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.aaps;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.MenuListActivity; import info.nightscout.androidaps.interaction.utils.MenuListActivity;
@ -13,23 +14,23 @@ public class StatusMenuActivity extends MenuListActivity {
@Override @Override
protected String[] getElements() { protected String[] getElements() {
return new String[] { return new String[] {
getResources().getString(R.string.status_pump), aaps.gs(R.string.status_pump),
getResources().getString(R.string.status_loop), aaps.gs(R.string.status_loop),
getResources().getString(R.string.status_cpp), aaps.gs(R.string.status_cpp),
getResources().getString(R.string.status_tdd)}; aaps.gs(R.string.status_tdd)};
} }
@Override @Override
protected void doAction(String action) { 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"); 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"); 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"); 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"); ListenerService.initiateAction(this, "tddstats");
} }
} }