remove direct access to sResources 1
This commit is contained in:
parent
cfaa26d337
commit
81ad2779bc
|
@ -131,9 +131,9 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
switch (v.getId()) {
|
||||
case R.id.profileswitch_remove:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(profileSwitch.date));
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
builder.setTitle(MainApp.gs(R.string.confirmation));
|
||||
builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(profileSwitch.date));
|
||||
builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = profileSwitch._id;
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
|
@ -144,7 +144,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
MainApp.getDbHelper().delete(profileSwitch);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
|
||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||
builder.show();
|
||||
break;
|
||||
case R.id.profileswitch_date:
|
||||
|
|
|
@ -140,9 +140,9 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements
|
|||
switch (v.getId()) {
|
||||
case R.id.temptargetrange_remove:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(tempTarget.date));
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
builder.setTitle(MainApp.gs(R.string.confirmation));
|
||||
builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(tempTarget.date));
|
||||
builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = tempTarget._id;
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
|
@ -153,7 +153,7 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements
|
|||
MainApp.getDbHelper().delete(tempTarget);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
|
||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||
builder.show();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class LogDialog {
|
|||
String logCat = "no logs";
|
||||
final String processId = Integer.toString(android.os.Process.myPid());
|
||||
try {
|
||||
Process process = Runtime.getRuntime().exec("logcat -d " + MainApp.sResources.getString(R.string.app_name) + ":D");
|
||||
Process process = Runtime.getRuntime().exec("logcat -d " + MainApp.gs(R.string.app_name) + ":D");
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
StringBuilder log = new StringBuilder();
|
||||
String line;
|
||||
|
@ -46,11 +46,11 @@ public class LogDialog {
|
|||
try {
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(context)
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(MainApp.sResources.getString(R.string.copy_to_clipboard), new DialogInterface.OnClickListener() {
|
||||
.setPositiveButton(MainApp.gs(R.string.copy_to_clipboard), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText(null, msg));
|
||||
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.copied_to_clipboard));
|
||||
ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.copied_to_clipboard));
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SP {
|
|||
}
|
||||
|
||||
static public String getString(int resourceID, String defaultValue) {
|
||||
return sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue);
|
||||
return sharedPreferences.getString(MainApp.gs(resourceID), defaultValue);
|
||||
}
|
||||
|
||||
static public String getString(String key, String defaultValue) {
|
||||
|
@ -26,7 +26,7 @@ public class SP {
|
|||
|
||||
static public boolean getBoolean(int resourceID, Boolean defaultValue) {
|
||||
try {
|
||||
return sharedPreferences.getBoolean(MainApp.sResources.getString(resourceID), defaultValue);
|
||||
return sharedPreferences.getBoolean(MainApp.gs(resourceID), defaultValue);
|
||||
} catch (Exception e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class SP {
|
|||
}
|
||||
|
||||
static public Double getDouble(int resourceID, Double defaultValue) {
|
||||
return SafeParse.stringToDouble(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
||||
return SafeParse.stringToDouble(sharedPreferences.getString(MainApp.gs(resourceID), defaultValue.toString()));
|
||||
}
|
||||
|
||||
static public Double getDouble(String key, Double defaultValue) {
|
||||
|
@ -50,9 +50,9 @@ public class SP {
|
|||
|
||||
static public int getInt(int resourceID, Integer defaultValue) {
|
||||
try {
|
||||
return sharedPreferences.getInt(MainApp.sResources.getString(resourceID), defaultValue);
|
||||
return sharedPreferences.getInt(MainApp.gs(resourceID), defaultValue);
|
||||
} catch (Exception e) {
|
||||
return SafeParse.stringToInt(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
||||
return SafeParse.stringToInt(sharedPreferences.getString(MainApp.gs(resourceID), defaultValue.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,9 @@ public class SP {
|
|||
|
||||
static public long getLong(int resourceID, Long defaultValue) {
|
||||
try {
|
||||
return sharedPreferences.getLong(MainApp.sResources.getString(resourceID), defaultValue);
|
||||
return sharedPreferences.getLong(MainApp.gs(resourceID), defaultValue);
|
||||
} catch (Exception e) {
|
||||
return SafeParse.stringToLong(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
||||
return SafeParse.stringToLong(sharedPreferences.getString(MainApp.gs(resourceID), defaultValue.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class SP {
|
|||
|
||||
static public void putBoolean(int resourceID, boolean value) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean(MainApp.sResources.getString(resourceID), value);
|
||||
editor.putBoolean(MainApp.gs(resourceID), value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class SP {
|
|||
|
||||
static public void putLong(int resourceID, long value) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putLong(MainApp.sResources.getString(resourceID), value);
|
||||
editor.putLong(MainApp.gs(resourceID), value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
@ -112,13 +112,13 @@ public class SP {
|
|||
|
||||
static public void putInt(int resourceID, int value) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putInt(MainApp.sResources.getString(resourceID), value);
|
||||
editor.putInt(MainApp.gs(resourceID), value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
static public void putString(int resourceID, String value) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(MainApp.sResources.getString(resourceID), value);
|
||||
editor.putString(MainApp.gs(resourceID), value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class SP {
|
|||
|
||||
static public void remove(int resourceID) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.remove(MainApp.sResources.getString(resourceID));
|
||||
editor.remove(MainApp.gs(resourceID));
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue