remove direct access to sResources 7
This commit is contained in:
parent
545d1d1586
commit
74d0c71712
11 changed files with 23 additions and 23 deletions
|
@ -32,17 +32,17 @@ public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return MainApp.sResources.getString(R.string.ultrarapid_oref);
|
return MainApp.gs(R.string.ultrarapid_oref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFriendlyName() {
|
public String getFriendlyName() {
|
||||||
return MainApp.sResources.getString(R.string.ultrarapid_oref);
|
return MainApp.gs(R.string.ultrarapid_oref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String commentStandardText() {
|
public String commentStandardText() {
|
||||||
return MainApp.sResources.getString(R.string.ultrafastactinginsulincomment);
|
return MainApp.gs(R.string.ultrafastactinginsulincomment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class LoopFragment extends SubscriberFragment {
|
||||||
|
|
||||||
@OnClick(R.id.loop_run)
|
@OnClick(R.id.loop_run)
|
||||||
void onRunClick() {
|
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();
|
new Thread(() -> LoopPlugin.getPlugin().invoke("Loop button", true)).start();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
|
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class DbLogger {
|
||||||
public static void dbAdd(Intent intent, String data) {
|
public static void dbAdd(Intent intent, String data) {
|
||||||
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
|
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||||
if (q.size() < 1) {
|
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");
|
log.error("DBADD No receivers");
|
||||||
} else if (Config.logNSUpload)
|
} else if (Config.logNSUpload)
|
||||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
|
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
|
||||||
|
@ -31,7 +31,7 @@ public class DbLogger {
|
||||||
public static void dbRemove(Intent intent, String data) {
|
public static void dbRemove(Intent intent, String data) {
|
||||||
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
|
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||||
if (q.size() < 1) {
|
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");
|
log.error("DBREMOVE No receivers");
|
||||||
} else if (Config.logNSUpload)
|
} else if (Config.logNSUpload)
|
||||||
log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);
|
log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class NSClientService extends Service {
|
||||||
MainApp.bus().post(new EventNSClientNewLog("ERROR", "Write treatment permission not granted !!!!"));
|
MainApp.bus().post(new EventNSClientNewLog("ERROR", "Write treatment permission not granted !!!!"));
|
||||||
}
|
}
|
||||||
if (!hasWriteAuth) {
|
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));
|
MainApp.bus().post(new EventNewNotification(noperm));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.NSCLIENT_NO_WRITE_PERMISSION));
|
MainApp.bus().post(new EventDismissNotification(Notification.NSCLIENT_NO_WRITE_PERMISSION));
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
|
||||||
currentTempView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getCurrentTempParam()));
|
currentTempView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getCurrentTempParam()));
|
||||||
try {
|
try {
|
||||||
JSONArray iobArray = new JSONArray(determineBasalAdapterAMAJS.getIobDataParam());
|
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) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
iobDataView.setText("JSONException");
|
iobDataView.setText("JSONException");
|
||||||
|
|
|
@ -255,9 +255,9 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||||
if (newvalue < lowLimit || newvalue > highLimit) {
|
if (newvalue < lowLimit || newvalue > highLimit) {
|
||||||
newvalue = Math.max(newvalue, lowLimit);
|
newvalue = Math.max(newvalue, lowLimit);
|
||||||
newvalue = Math.min(newvalue, highLimit);
|
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 += ".\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);
|
log.error(msg);
|
||||||
NSUpload.uploadError(msg);
|
NSUpload.uploadError(msg);
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), msg, R.raw.error);
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), msg, R.raw.error);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class DanaRS_Packet_Basal_Get_Basal_Rate extends DanaRS_Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.basalStep != 0.01d) {
|
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));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class DanaRS_Packet_Bolus_Get_Bolus_Option extends DanaRS_Packet {
|
||||||
int missedBolus04EndMin = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
int missedBolus04EndMin = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||||
|
|
||||||
if (!pump.isExtendedBolusEnabled) {
|
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));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
||||||
|
|
|
@ -30,23 +30,23 @@ public class DanaRS_Packet_Notify_Alarm extends DanaRS_Packet {
|
||||||
switch (alarmCode) {
|
switch (alarmCode) {
|
||||||
case 0x01:
|
case 0x01:
|
||||||
// Battery 0% Alarm
|
// Battery 0% Alarm
|
||||||
errorString = MainApp.sResources.getString(R.string.batterydischarged);
|
errorString = MainApp.gs(R.string.batterydischarged);
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
// Pump Error
|
// Pump Error
|
||||||
errorString = MainApp.sResources.getString(R.string.pumperror) + " " + alarmCode;
|
errorString = MainApp.gs(R.string.pumperror) + " " + alarmCode;
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
// Occlusion
|
// Occlusion
|
||||||
errorString = MainApp.sResources.getString(R.string.occlusion);
|
errorString = MainApp.gs(R.string.occlusion);
|
||||||
break;
|
break;
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// LOW BATTERY
|
// LOW BATTERY
|
||||||
errorString = MainApp.sResources.getString(R.string.lowbattery);
|
errorString = MainApp.gs(R.string.lowbattery);
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
// Shutdown
|
// Shutdown
|
||||||
errorString = MainApp.sResources.getString(R.string.lowbattery);
|
errorString = MainApp.gs(R.string.lowbattery);
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
// Basal Compare
|
// Basal Compare
|
||||||
|
@ -54,20 +54,20 @@ public class DanaRS_Packet_Notify_Alarm extends DanaRS_Packet {
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// Empty Reservoir
|
// Empty Reservoir
|
||||||
errorString = MainApp.sResources.getString(R.string.emptyreservoir);
|
errorString = MainApp.gs(R.string.emptyreservoir);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// BT
|
// BT
|
||||||
case 0x07:
|
case 0x07:
|
||||||
case 0xFF:
|
case 0xFF:
|
||||||
// Blood sugar measurement alert
|
// Blood sugar measurement alert
|
||||||
errorString = MainApp.sResources.getString(R.string.bloodsugarmeasurementalert);
|
errorString = MainApp.gs(R.string.bloodsugarmeasurementalert);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x08:
|
case 0x08:
|
||||||
case 0xFE:
|
case 0xFE:
|
||||||
// Remaining insulin level
|
// Remaining insulin level
|
||||||
errorString = MainApp.sResources.getString(R.string.remaininsulinalert);
|
errorString = MainApp.gs(R.string.remaininsulinalert);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xFD:
|
case 0xFD:
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DanaRS_Packet_Notify_Delivery_Complete extends DanaRS_Packet {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
t.insulin = deliveredInsulin;
|
t.insulin = deliveredInsulin;
|
||||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
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.t = t;
|
||||||
bolusingEvent.percent = Math.min((int) (deliveredInsulin / amount * 100), 100);
|
bolusingEvent.percent = Math.min((int) (deliveredInsulin / amount * 100), 100);
|
||||||
done = true;
|
done = true;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
pump.productCode = intFromBuff(bytes, 2, 1);
|
pump.productCode = intFromBuff(bytes, 2, 1);
|
||||||
if (pump.model != DanaRPump.EXPORT_MODEL) {
|
if (pump.model != DanaRPump.EXPORT_MODEL) {
|
||||||
pump.lastConnection = 0;
|
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.bus().post(new EventNewNotification(notification));
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to Korean DanaR");
|
log.debug("Wrong model selected. Switching to Korean DanaR");
|
||||||
|
@ -64,7 +64,7 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
|
|
||||||
if (pump.protocol != 2) {
|
if (pump.protocol != 2) {
|
||||||
pump.lastConnection = 0;
|
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.bus().post(new EventNewNotification(notification));
|
||||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to non APS DanaR");
|
log.debug("Wrong model selected. Switching to non APS DanaR");
|
||||||
|
|
Loading…
Reference in a new issue