use gs function in MainApp to get strings

This commit is contained in:
AdrianLxM 2018-05-02 13:04:21 +02:00
parent 6fa3c04db8
commit 7b6402de09
12 changed files with 63 additions and 63 deletions

View file

@ -158,7 +158,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
if (activeExtendedBolus != null) { if (activeExtendedBolus != null) {
extendedBolus.setVisibility(View.GONE); extendedBolus.setVisibility(View.GONE);
extendedBolusCancel.setVisibility(View.VISIBLE); extendedBolusCancel.setVisibility(View.VISIBLE);
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + activeExtendedBolus.toString()); extendedBolusCancel.setText(MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toString());
} else { } else {
extendedBolus.setVisibility(View.VISIBLE); extendedBolus.setVisibility(View.VISIBLE);
extendedBolusCancel.setVisibility(View.GONE); extendedBolusCancel.setVisibility(View.GONE);
@ -174,7 +174,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
if (activeTemp != null) { if (activeTemp != null) {
tempBasal.setVisibility(View.GONE); tempBasal.setVisibility(View.GONE);
tempBasalCancel.setVisibility(View.VISIBLE); tempBasalCancel.setVisibility(View.VISIBLE);
tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + activeTemp.toStringShort()); tempBasalCancel.setText(MainApp.gs(R.string.cancel) + " " + activeTemp.toStringShort());
} else { } else {
tempBasal.setVisibility(View.VISIBLE); tempBasal.setVisibility(View.VISIBLE);
tempBasalCancel.setVisibility(View.GONE); tempBasalCancel.setVisibility(View.GONE);

View file

@ -104,23 +104,23 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
PumpInterface pump = ConfigBuilderPlugin.getActivePump(); PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (profile == null) { if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected)); log.debug(MainApp.gs(R.string.noprofileselected));
return; return;
} }
if (!isEnabled(PluginType.APS)) { if (!isEnabled(PluginType.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.openapsma_disabled)); log.debug(MainApp.gs(R.string.openapsma_disabled));
return; return;
} }
if (glucoseStatus == null) { if (glucoseStatus == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noglucosedata))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata)); log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
return; return;
} }

View file

@ -104,23 +104,23 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface {
PumpInterface pump = ConfigBuilderPlugin.getActivePump(); PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (profile == null) { if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected)); log.debug(MainApp.gs(R.string.noprofileselected));
return; return;
} }
if (!isEnabled(PluginType.APS)) { if (!isEnabled(PluginType.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.openapsma_disabled)); log.debug(MainApp.gs(R.string.openapsma_disabled));
return; return;
} }
if (glucoseStatus == null) { if (glucoseStatus == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noglucosedata))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata)); log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
return; return;
} }

View file

@ -107,23 +107,23 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
PumpInterface pump = ConfigBuilderPlugin.getActivePump(); PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (profile == null) { if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.noprofileselected)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected)); log.debug(MainApp.gs(R.string.noprofileselected));
return; return;
} }
if (!isEnabled(PluginType.APS)) { if (!isEnabled(PluginType.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.openapsma_disabled)); log.debug(MainApp.gs(R.string.openapsma_disabled));
return; return;
} }
if (glucoseStatus == null) { if (glucoseStatus == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noglucosedata))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.gs(R.string.openapsma_noglucosedata)));
if (Config.logAPSResult) if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata)); log.debug(MainApp.gs(R.string.openapsma_noglucosedata));
return; return;
} }

View file

@ -458,7 +458,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
log.error("deliverTreatment: Invalid input"); log.error("deliverTreatment: Invalid input");
return new PumpEnactResult().success(false).enacted(false) return new PumpEnactResult().success(false).enacted(false)
.bolusDelivered(0d).carbsDelivered(0d) .bolusDelivered(0d).carbsDelivered(0d)
.comment(MainApp.instance().getString(R.string.danar_invalidinput)); .comment(MainApp.gs(R.string.danar_invalidinput));
} else if (detailedBolusInfo.insulin > 0) { } else if (detailedBolusInfo.insulin > 0) {
// bolus needed, ask pump to deliver it // bolus needed, ask pump to deliver it
return deliverBolus(detailedBolusInfo); return deliverBolus(detailedBolusInfo);
@ -474,7 +474,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
return new PumpEnactResult().success(true).enacted(true) return new PumpEnactResult().success(true).enacted(true)
.bolusDelivered(0d).carbsDelivered(detailedBolusInfo.carbs) .bolusDelivered(0d).carbsDelivered(detailedBolusInfo.carbs)
.comment(MainApp.instance().getString(R.string.virtualpump_resultok)); .comment(MainApp.gs(R.string.virtualpump_resultok));
} }
} finally { } finally {
MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventComboPumpUpdateGUI());

View file

@ -166,7 +166,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
result.isTempCancel = false; result.isTempCancel = false;
result.enacted = false; result.enacted = false;
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.danar_invalidinput); result.comment = MainApp.gs(R.string.danar_invalidinput);
log.error("setTempBasalPercent: Invalid input"); log.error("setTempBasalPercent: Invalid input");
return result; return result;
} }
@ -178,7 +178,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
result.enacted = false; result.enacted = false;
result.success = true; result.success = true;
result.isTempCancel = false; result.isTempCancel = false;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
result.duration = pump.tempBasalRemainingMin; result.duration = pump.tempBasalRemainingMin;
result.percent = pump.tempBasalPercent; result.percent = pump.tempBasalPercent;
result.isPercent = true; result.isPercent = true;
@ -191,7 +191,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
result.enacted = true; result.enacted = true;
result.success = true; result.success = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
result.isTempCancel = false; result.isTempCancel = false;
result.duration = pump.tempBasalRemainingMin; result.duration = pump.tempBasalRemainingMin;
result.percent = pump.tempBasalPercent; result.percent = pump.tempBasalPercent;
@ -202,7 +202,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
} }
result.enacted = false; result.enacted = false;
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.tempbasaldeliveryerror); result.comment = MainApp.gs(R.string.tempbasaldeliveryerror);
log.error("setTempBasalPercent: Failed to set temp basal"); log.error("setTempBasalPercent: Failed to set temp basal");
return result; return result;
} }
@ -219,7 +219,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) { if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
result.enacted = false; result.enacted = false;
result.success = true; result.success = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
result.duration = pump.extendedBolusRemainingMinutes; result.duration = pump.extendedBolusRemainingMinutes;
result.absolute = pump.extendedBolusAbsoluteRate; result.absolute = pump.extendedBolusAbsoluteRate;
result.isPercent = false; result.isPercent = false;
@ -232,7 +232,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
if (connectionOK && pump.isExtendedInProgress && Math.abs(pump.extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) { if (connectionOK && pump.isExtendedInProgress && Math.abs(pump.extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
result.enacted = true; result.enacted = true;
result.success = true; result.success = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
result.isTempCancel = false; result.isTempCancel = false;
result.duration = pump.extendedBolusRemainingMinutes; result.duration = pump.extendedBolusRemainingMinutes;
result.absolute = pump.extendedBolusAbsoluteRate; result.absolute = pump.extendedBolusAbsoluteRate;
@ -245,7 +245,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
} }
result.enacted = false; result.enacted = false;
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); result.comment = MainApp.gs(R.string.danar_valuenotsetproperly);
log.error("setExtendedBolus: Failed to extended bolus"); log.error("setExtendedBolus: Failed to extended bolus");
return result; return result;
} }
@ -261,13 +261,13 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
} }
if (!pump.isExtendedInProgress) { if (!pump.isExtendedInProgress) {
result.success = true; result.success = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
if (Config.logPumpActions) if (Config.logPumpActions)
log.debug("cancelExtendedBolus: OK"); log.debug("cancelExtendedBolus: OK");
return result; return result;
} else { } else {
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); result.comment = MainApp.gs(R.string.danar_valuenotsetproperly);
log.error("cancelExtendedBolus: Failed to cancel extended bolus"); log.error("cancelExtendedBolus: Failed to cancel extended bolus");
return result; return result;
} }

View file

@ -395,7 +395,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
result.bolusDelivered = detailedBolusInfo.insulin; result.bolusDelivered = detailedBolusInfo.insulin;
result.carbsDelivered = detailedBolusInfo.carbs; result.carbsDelivered = detailedBolusInfo.carbs;
result.enacted = result.bolusDelivered > 0 || result.carbsDelivered > 0; result.enacted = result.bolusDelivered > 0 || result.carbsDelivered > 0;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
result.percent = 100; result.percent = 100;
@ -796,7 +796,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
} }
private String gs(int id) { private String gs(int id) {
return MainApp.instance().getString(id); return MainApp.gs(id);
} }
private boolean isPumpRunning() { private boolean isPumpRunning() {

View file

@ -134,7 +134,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
result.success = true; result.success = true;
result.bolusDelivered = detailedBolusInfo.insulin; result.bolusDelivered = detailedBolusInfo.insulin;
result.carbsDelivered = detailedBolusInfo.carbs; result.carbsDelivered = detailedBolusInfo.carbs;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo); TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo);
return result; return result;
} }
@ -147,7 +147,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) { public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror); result.comment = MainApp.gs(R.string.pumperror);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting temp basal absolute: " + result); log.debug("Setting temp basal absolute: " + result);
return result; return result;
@ -157,7 +157,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) { public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror); result.comment = MainApp.gs(R.string.pumperror);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Settings temp basal percent: " + result); log.debug("Settings temp basal percent: " + result);
return result; return result;
@ -167,7 +167,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) { public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror); result.comment = MainApp.gs(R.string.pumperror);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting extended bolus: " + result); log.debug("Setting extended bolus: " + result);
return result; return result;
@ -177,7 +177,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
public PumpEnactResult cancelTempBasal(boolean force) { public PumpEnactResult cancelTempBasal(boolean force) {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror); result.comment = MainApp.gs(R.string.pumperror);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Cancel temp basal: " + result); log.debug("Cancel temp basal: " + result);
return result; return result;
@ -187,7 +187,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
public PumpEnactResult cancelExtendedBolus() { public PumpEnactResult cancelExtendedBolus() {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = false; result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror); result.comment = MainApp.gs(R.string.pumperror);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Canceling extended basal: " + result); log.debug("Canceling extended basal: " + result);
return result; return result;

View file

@ -202,7 +202,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
result.bolusDelivered = detailedBolusInfo.insulin; result.bolusDelivered = detailedBolusInfo.insulin;
result.carbsDelivered = detailedBolusInfo.carbs; result.carbsDelivered = detailedBolusInfo.carbs;
result.enacted = result.bolusDelivered > 0 || result.carbsDelivered > 0; result.enacted = result.bolusDelivered > 0 || result.carbsDelivered > 0;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
Double delivering = 0d; Double delivering = 0d;
@ -246,7 +246,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
result.isTempCancel = false; result.isTempCancel = false;
result.absolute = absoluteRate; result.absolute = absoluteRate;
result.duration = durationInMinutes; result.duration = durationInMinutes;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal); TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting temp basal absolute: " + result); log.debug("Setting temp basal absolute: " + result);
@ -274,7 +274,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
result.isPercent = true; result.isPercent = true;
result.isTempCancel = false; result.isTempCancel = false;
result.duration = durationInMinutes; result.duration = durationInMinutes;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal); TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Settings temp basal percent: " + result); log.debug("Settings temp basal percent: " + result);
@ -298,7 +298,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
result.bolusDelivered = insulin; result.bolusDelivered = insulin;
result.isTempCancel = false; result.isTempCancel = false;
result.duration = durationInMinutes; result.duration = durationInMinutes;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
TreatmentsPlugin.getPlugin().addToHistoryExtendedBolus(extendedBolus); TreatmentsPlugin.getPlugin().addToHistoryExtendedBolus(extendedBolus);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Setting extended bolus: " + result); log.debug("Setting extended bolus: " + result);
@ -312,7 +312,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
result.success = true; result.success = true;
result.isTempCancel = true; result.isTempCancel = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) { if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
result.enacted = true; result.enacted = true;
TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER); TemporaryBasal tempStop = new TemporaryBasal().date(System.currentTimeMillis()).source(Source.USER);
@ -337,7 +337,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
result.isTempCancel = true; result.isTempCancel = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
if (Config.logPumpComm) if (Config.logPumpComm)
log.debug("Canceling extended basal: " + result); log.debug("Canceling extended basal: " + result);
MainApp.bus().post(new EventVirtualPumpUpdateGui()); MainApp.bus().post(new EventVirtualPumpUpdateGui());

View file

@ -95,9 +95,9 @@ public class ActionStringHandler {
return; return;
} }
Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value(); Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value();
rMessage += MainApp.instance().getString(R.string.primefill) + ": " + insulinAfterConstraints + "U"; rMessage += MainApp.gs(R.string.primefill) + ": " + insulinAfterConstraints + "U";
if (insulinAfterConstraints - amount != 0) if (insulinAfterConstraints - amount != 0)
rMessage += "\n" + MainApp.instance().getString(R.string.constraintapllied); rMessage += "\n" + MainApp.gs(R.string.constraintapllied);
rAction += "fill " + insulinAfterConstraints; rAction += "fill " + insulinAfterConstraints;
@ -106,9 +106,9 @@ public class ActionStringHandler {
double amount = SafeParse.stringToDouble(act[1]); double amount = SafeParse.stringToDouble(act[1]);
Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value(); Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value();
rMessage += MainApp.instance().getString(R.string.primefill) + ": " + insulinAfterConstraints + "U"; rMessage += MainApp.gs(R.string.primefill) + ": " + insulinAfterConstraints + "U";
if (insulinAfterConstraints - amount != 0) if (insulinAfterConstraints - amount != 0)
rMessage += "\n" + MainApp.instance().getString(R.string.constraintapllied); rMessage += "\n" + MainApp.gs(R.string.constraintapllied);
rAction += "fill " + insulinAfterConstraints; rAction += "fill " + insulinAfterConstraints;
@ -118,11 +118,11 @@ public class ActionStringHandler {
int carbs = SafeParse.stringToInt(act[2]); int carbs = SafeParse.stringToInt(act[2]);
Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(insulin)).value(); Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(insulin)).value();
Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(carbs)).value(); Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(carbs)).value();
rMessage += MainApp.instance().getString(R.string.bolus) + ": " + insulinAfterConstraints + "U\n"; rMessage += MainApp.gs(R.string.bolus) + ": " + insulinAfterConstraints + "U\n";
rMessage += MainApp.instance().getString(R.string.carbs) + ": " + carbsAfterConstraints + "g"; rMessage += MainApp.gs(R.string.carbs) + ": " + carbsAfterConstraints + "g";
if ((insulinAfterConstraints - insulin != 0) || (carbsAfterConstraints - carbs != 0)) { if ((insulinAfterConstraints - insulin != 0) || (carbsAfterConstraints - carbs != 0)) {
rMessage += "\n" + MainApp.instance().getString(R.string.constraintapllied); rMessage += "\n" + MainApp.gs(R.string.constraintapllied);
} }
rAction += "bolus " + insulinAfterConstraints + " " + carbsAfterConstraints; rAction += "bolus " + insulinAfterConstraints + " " + carbsAfterConstraints;
@ -283,7 +283,7 @@ public class ActionStringHandler {
//if pump is not busy: try to fetch data //if pump is not busy: try to fetch data
final PumpInterface pump = MainApp.getConfigBuilder().getActivePump(); final PumpInterface pump = MainApp.getConfigBuilder().getActivePump();
if (pump.isBusy()) { if (pump.isBusy()) {
rMessage += MainApp.instance().getString(R.string.pumpbusy); rMessage += MainApp.gs(R.string.pumpbusy);
} else { } else {
rMessage += "trying to fetch data from pump."; rMessage += "trying to fetch data from pump.";

View file

@ -578,7 +578,7 @@ public class WatchUpdaterService extends WearableListenerService implements
if (googleApiClient.isConnected()) { if (googleApiClient.isConnected()) {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
String status = MainApp.instance().getString(R.string.noprofile); String status = MainApp.gs(R.string.noprofile);
String iobSum, iobDetail, cobString, currentBasal, bgiString; String iobSum, iobDetail, cobString, currentBasal, bgiString;
iobSum = iobDetail = cobString = currentBasal = bgiString = ""; iobSum = iobDetail = cobString = currentBasal = bgiString = "";
if (profile != null) { if (profile != null) {

View file

@ -55,7 +55,7 @@ public class NSUpload {
if (temporaryBasal.pumpId != 0) if (temporaryBasal.pumpId != 0)
data.put("pumpId", temporaryBasal.pumpId); data.put("pumpId", temporaryBasal.pumpId);
data.put("created_at", DateUtil.toISOString(temporaryBasal.date)); data.put("created_at", DateUtil.toISOString(temporaryBasal.date));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
if (originalExtendedAmount != null) if (originalExtendedAmount != null)
data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -93,7 +93,7 @@ public class NSUpload {
if (temporaryBasal.pumpId != 0) if (temporaryBasal.pumpId != 0)
data.put("pumpId", temporaryBasal.pumpId); data.put("pumpId", temporaryBasal.pumpId);
data.put("created_at", DateUtil.toISOString(temporaryBasal.date)); data.put("created_at", DateUtil.toISOString(temporaryBasal.date));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd"); bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments"); bundle.putString("collection", "treatments");
@ -115,7 +115,7 @@ public class NSUpload {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.TEMPBASAL); data.put("eventType", CareportalEvent.TEMPBASAL);
data.put("created_at", DateUtil.toISOString(time)); data.put("created_at", DateUtil.toISOString(time));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
if (isFakedTempBasal) if (isFakedTempBasal)
data.put("isFakedTempBasal", isFakedTempBasal); data.put("isFakedTempBasal", isFakedTempBasal);
if (pumpId != 0) if (pumpId != 0)
@ -147,7 +147,7 @@ public class NSUpload {
if (extendedBolus.pumpId != 0) if (extendedBolus.pumpId != 0)
data.put("pumpId", extendedBolus.pumpId); data.put("pumpId", extendedBolus.pumpId);
data.put("created_at", DateUtil.toISOString(extendedBolus.date)); data.put("created_at", DateUtil.toISOString(extendedBolus.date));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd"); bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments"); bundle.putString("collection", "treatments");
@ -173,7 +173,7 @@ public class NSUpload {
data.put("enteredinsulin", 0); data.put("enteredinsulin", 0);
data.put("relative", 0); data.put("relative", 0);
data.put("created_at", DateUtil.toISOString(time)); data.put("created_at", DateUtil.toISOString(time));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
if (pumpId != 0) if (pumpId != 0)
data.put("pumpId", pumpId); data.put("pumpId", pumpId);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -301,7 +301,7 @@ public class NSUpload {
data.put("percentage", profileSwitch.percentage); data.put("percentage", profileSwitch.percentage);
} }
data.put("created_at", DateUtil.toISOString(profileSwitch.date)); data.put("created_at", DateUtil.toISOString(profileSwitch.date));
data.put("enteredBy", MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", MainApp.gs(R.string.app_name));
uploadCareportalEntryToNS(data); uploadCareportalEntryToNS(data);
} catch (JSONException e) { } catch (JSONException e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
@ -325,7 +325,7 @@ public class NSUpload {
data.put("targetTop", Profile.fromMgdlToUnits(tempTarget.high, profile.getUnits())); data.put("targetTop", Profile.fromMgdlToUnits(tempTarget.high, profile.getUnits()));
data.put("created_at", DateUtil.toISOString(tempTarget.date)); data.put("created_at", DateUtil.toISOString(tempTarget.date));
data.put("units", profile.getUnits()); data.put("units", profile.getUnits());
data.put("enteredBy", MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", MainApp.gs(R.string.app_name));
uploadCareportalEntryToNS(data); uploadCareportalEntryToNS(data);
} catch (JSONException e) { } catch (JSONException e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
@ -346,7 +346,7 @@ public class NSUpload {
data.put("percentage", profileSwitch.percentage); data.put("percentage", profileSwitch.percentage);
} }
data.put("created_at", DateUtil.toISOString(profileSwitch.date)); data.put("created_at", DateUtil.toISOString(profileSwitch.date));
data.put("enteredBy", MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", MainApp.gs(R.string.app_name));
if (profileSwitch._id != null) { if (profileSwitch._id != null) {
Context context = MainApp.instance().getApplicationContext(); Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -420,7 +420,7 @@ public class NSUpload {
data.put("eventType", "OpenAPS Offline"); data.put("eventType", "OpenAPS Offline");
data.put("duration", durationInMinutes); data.put("duration", durationInMinutes);
data.put("created_at", DateUtil.toISOString(new Date())); data.put("created_at", DateUtil.toISOString(new Date()));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name)); data.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd"); bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments"); bundle.putString("collection", "treatments");