remove direct access to sResources 7

This commit is contained in:
AdrianLxM 2018-05-02 13:51:24 +02:00
parent 545d1d1586
commit 74d0c71712
11 changed files with 23 additions and 23 deletions

View file

@ -32,17 +32,17 @@ public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
@Override
public String getName() {
return MainApp.sResources.getString(R.string.ultrarapid_oref);
return MainApp.gs(R.string.ultrarapid_oref);
}
@Override
public String getFriendlyName() {
return MainApp.sResources.getString(R.string.ultrarapid_oref);
return MainApp.gs(R.string.ultrarapid_oref);
}
@Override
public String commentStandardText() {
return MainApp.sResources.getString(R.string.ultrafastactinginsulincomment);
return MainApp.gs(R.string.ultrafastactinginsulincomment);
}
@Override

View file

@ -65,7 +65,7 @@ public class LoopFragment extends SubscriberFragment {
@OnClick(R.id.loop_run)
void onRunClick() {
lastRunView.setText(MainApp.sResources.getString(R.string.executing));
lastRunView.setText(MainApp.gs(R.string.executing));
new Thread(() -> LoopPlugin.getPlugin().invoke("Loop button", true)).start();
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
}

View file

@ -22,7 +22,7 @@ public class DbLogger {
public static void dbAdd(Intent intent, String data) {
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
if (q.size() < 1) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.sResources.getString(R.string.nsclientnotinstalled));
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.gs(R.string.nsclientnotinstalled));
log.error("DBADD No receivers");
} else if (Config.logNSUpload)
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
@ -31,7 +31,7 @@ public class DbLogger {
public static void dbRemove(Intent intent, String data) {
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
if (q.size() < 1) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.sResources.getString(R.string.nsclientnotinstalled));
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.gs(R.string.nsclientnotinstalled));
log.error("DBREMOVE No receivers");
} else if (Config.logNSUpload)
log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);

View file

@ -309,7 +309,7 @@ public class NSClientService extends Service {
MainApp.bus().post(new EventNSClientNewLog("ERROR", "Write treatment permission not granted !!!!"));
}
if (!hasWriteAuth) {
Notification noperm = new Notification(Notification.NSCLIENT_NO_WRITE_PERMISSION, MainApp.sResources.getString(R.string.nowritepermission), Notification.URGENT);
Notification noperm = new Notification(Notification.NSCLIENT_NO_WRITE_PERMISSION, MainApp.gs(R.string.nowritepermission), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(noperm));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.NSCLIENT_NO_WRITE_PERMISSION));

View file

@ -107,7 +107,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
currentTempView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getCurrentTempParam()));
try {
JSONArray iobArray = new JSONArray(determineBasalAdapterAMAJS.getIobDataParam());
iobDataView.setText(String.format(MainApp.sResources.getString(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0)));
iobDataView.setText(String.format(MainApp.gs(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0)));
} catch (JSONException e) {
log.error("Unhandled exception", e);
iobDataView.setText("JSONException");

View file

@ -255,9 +255,9 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
if (newvalue < lowLimit || newvalue > highLimit) {
newvalue = Math.max(newvalue, lowLimit);
newvalue = Math.min(newvalue, highLimit);
String msg = String.format(MainApp.sResources.getString(R.string.valueoutofrange), valueName);
String msg = String.format(MainApp.gs(R.string.valueoutofrange), valueName);
msg += ".\n";
msg += String.format(MainApp.sResources.getString(R.string.valuelimitedto), value, newvalue);
msg += String.format(MainApp.gs(R.string.valuelimitedto), value, newvalue);
log.error(msg);
NSUpload.uploadError(msg);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), msg, R.raw.error);

View file

@ -53,7 +53,7 @@ public class DanaRS_Packet_Basal_Get_Basal_Rate extends DanaRS_Packet {
}
if (pump.basalStep != 0.01d) {
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.sResources.getString(R.string.danar_setbasalstep001), Notification.URGENT);
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));

View file

@ -102,7 +102,7 @@ public class DanaRS_Packet_Bolus_Get_Bolus_Option extends DanaRS_Packet {
int missedBolus04EndMin = byteArrayToInt(getBytes(data, dataIndex, dataSize));
if (!pump.isExtendedBolusEnabled) {
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.sResources.getString(R.string.danar_enableextendedbolus), Notification.URGENT);
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));

View file

@ -30,23 +30,23 @@ public class DanaRS_Packet_Notify_Alarm extends DanaRS_Packet {
switch (alarmCode) {
case 0x01:
// Battery 0% Alarm
errorString = MainApp.sResources.getString(R.string.batterydischarged);
errorString = MainApp.gs(R.string.batterydischarged);
break;
case 0x02:
// Pump Error
errorString = MainApp.sResources.getString(R.string.pumperror) + " " + alarmCode;
errorString = MainApp.gs(R.string.pumperror) + " " + alarmCode;
break;
case 0x03:
// Occlusion
errorString = MainApp.sResources.getString(R.string.occlusion);
errorString = MainApp.gs(R.string.occlusion);
break;
case 0x04:
// LOW BATTERY
errorString = MainApp.sResources.getString(R.string.lowbattery);
errorString = MainApp.gs(R.string.lowbattery);
break;
case 0x05:
// Shutdown
errorString = MainApp.sResources.getString(R.string.lowbattery);
errorString = MainApp.gs(R.string.lowbattery);
break;
case 0x06:
// Basal Compare
@ -54,20 +54,20 @@ public class DanaRS_Packet_Notify_Alarm extends DanaRS_Packet {
break;
case 0x09:
// Empty Reservoir
errorString = MainApp.sResources.getString(R.string.emptyreservoir);
errorString = MainApp.gs(R.string.emptyreservoir);
break;
// BT
case 0x07:
case 0xFF:
// Blood sugar measurement alert
errorString = MainApp.sResources.getString(R.string.bloodsugarmeasurementalert);
errorString = MainApp.gs(R.string.bloodsugarmeasurementalert);
break;
case 0x08:
case 0xFE:
// Remaining insulin level
errorString = MainApp.sResources.getString(R.string.remaininsulinalert);
errorString = MainApp.gs(R.string.remaininsulinalert);
break;
case 0xFD:

View file

@ -39,7 +39,7 @@ public class DanaRS_Packet_Notify_Delivery_Complete extends DanaRS_Packet {
if (t != null) {
t.insulin = deliveredInsulin;
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), deliveredInsulin);
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), deliveredInsulin);
bolusingEvent.t = t;
bolusingEvent.percent = Math.min((int) (deliveredInsulin / amount * 100), 100);
done = true;

View file

@ -39,7 +39,7 @@ public class MsgCheckValue_v2 extends MessageBase {
pump.productCode = intFromBuff(bytes, 2, 1);
if (pump.model != DanaRPump.EXPORT_MODEL) {
pump.lastConnection = 0;
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.sResources.getString(R.string.pumpdrivercorrected), Notification.NORMAL);
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
log.debug("Wrong model selected. Switching to Korean DanaR");
@ -64,7 +64,7 @@ public class MsgCheckValue_v2 extends MessageBase {
if (pump.protocol != 2) {
pump.lastConnection = 0;
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.sResources.getString(R.string.pumpdrivercorrected), Notification.NORMAL);
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
log.debug("Wrong model selected. Switching to non APS DanaR");