remove direct access to sResources 5
This commit is contained in:
parent
3979913a6d
commit
0e4e36f2b1
8 changed files with 14 additions and 14 deletions
|
@ -413,7 +413,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
final SpannableString messageSpanned = new SpannableString(message);
|
final SpannableString messageSpanned = new SpannableString(message);
|
||||||
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS);
|
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS);
|
||||||
builder.setMessage(messageSpanned);
|
builder.setMessage(messageSpanned);
|
||||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
builder.setPositiveButton(MainApp.gs(R.string.ok), null);
|
||||||
AlertDialog alertDialog = builder.create();
|
AlertDialog alertDialog = builder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
((TextView)alertDialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
|
((TextView)alertDialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
// reservoir
|
// reservoir
|
||||||
int reservoirLevel = plugin.getPump().reservoirLevel;
|
int reservoirLevel = plugin.getPump().reservoirLevel;
|
||||||
if (reservoirLevel != -1) {
|
if (reservoirLevel != -1) {
|
||||||
reservoirView.setText(reservoirLevel + " " + MainApp.sResources.getString(R.string.insulin_unit_shortname));
|
reservoirView.setText(reservoirLevel + " " + MainApp.gs(R.string.insulin_unit_shortname));
|
||||||
} else if (ps.insulinState == PumpState.LOW) {
|
} else if (ps.insulinState == PumpState.LOW) {
|
||||||
reservoirView.setText(MainApp.gs(R.string.combo_reservoir_low));
|
reservoirView.setText(MainApp.gs(R.string.combo_reservoir_low));
|
||||||
} else if (ps.insulinState == PumpState.EMPTY) {
|
} else if (ps.insulinState == PumpState.EMPTY) {
|
||||||
|
|
|
@ -95,22 +95,22 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
||||||
}
|
}
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
log.error("setNewBasalProfile not initialized");
|
log.error("setNewBasalProfile not initialized");
|
||||||
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
result.comment = MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet);
|
result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
}
|
}
|
||||||
if (!sExecutionService.updateBasalsInPump(profile)) {
|
if (!sExecutionService.updateBasalsInPump(profile)) {
|
||||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.sResources.getString(R.string.failedupdatebasalprofile), Notification.URGENT);
|
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
result.comment = MainApp.sResources.getString(R.string.failedupdatebasalprofile);
|
result.comment = MainApp.gs(R.string.failedupdatebasalprofile);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||||
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.sResources.getString(R.string.profile_set_ok), Notification.INFO, 60);
|
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
if (pump.lastConnection != 0) {
|
if (pump.lastConnection != 0) {
|
||||||
Long agoMsec = System.currentTimeMillis() - pump.lastConnection;
|
Long agoMsec = System.currentTimeMillis() - pump.lastConnection;
|
||||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||||
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
lastConnectionView.setText(DateUtil.timeString(pump.lastConnection) + " (" + String.format(MainApp.gs(R.string.minago), agoMin) + ")");
|
||||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||||
}
|
}
|
||||||
if (pump.lastBolusTime.getTime() != 0) {
|
if (pump.lastBolusTime.getTime() != 0) {
|
||||||
|
@ -247,7 +247,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||||
iobView.setText(pump.iob + " U");
|
iobView.setText(pump.iob + " U");
|
||||||
if (pump.model != 0 || pump.protocol != 0 || pump.productCode != 0) {
|
if (pump.model != 0 || pump.protocol != 0 || pump.productCode != 0) {
|
||||||
firmwareView.setText(String.format(MainApp.sResources.getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
firmwareView.setText(String.format(MainApp.gs(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||||
} else {
|
} else {
|
||||||
firmwareView.setText("OLD");
|
firmwareView.setText("OLD");
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ public class DanaRHistoryActivity extends Activity {
|
||||||
});
|
});
|
||||||
profile = MainApp.getConfigBuilder().getProfile();
|
profile = MainApp.getConfigBuilder().getProfile();
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.noprofile));
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.noprofile));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class MsgBolusProgress extends MessageBase {
|
||||||
Double done = (amount * 100 - progress) / 100d;
|
Double done = (amount * 100 - progress) / 100d;
|
||||||
t.insulin = done;
|
t.insulin = done;
|
||||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||||
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), done);
|
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), done);
|
||||||
bolusingEvent.t = t;
|
bolusingEvent.t = t;
|
||||||
bolusingEvent.percent = Math.min((int) (done / amount * 100), 100);
|
bolusingEvent.percent = Math.min((int) (done / amount * 100), 100);
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ public class MsgBolusStop extends MessageBase {
|
||||||
stopped = true;
|
stopped = true;
|
||||||
if (!forced) {
|
if (!forced) {
|
||||||
t.insulin = amount;
|
t.insulin = amount;
|
||||||
bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusprogress_delivered);
|
bolusingEvent.status = MainApp.gs(R.string.overview_bolusprogress_delivered);
|
||||||
bolusingEvent.percent = 100;
|
bolusingEvent.percent = 100;
|
||||||
} else {
|
} else {
|
||||||
bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusprogress_stoped);
|
bolusingEvent.status = MainApp.gs(R.string.overview_bolusprogress_stoped);
|
||||||
}
|
}
|
||||||
MainApp.bus().post(bolusingEvent);
|
MainApp.bus().post(bolusingEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class MsgInitConnStatusBolus extends MessageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
Loading…
Reference in a new issue