From 7b6402de098c67626420f753558caaa91e27c392 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Wed, 2 May 2018 13:04:21 +0200 Subject: [PATCH] use gs function in MainApp to get strings --- .../plugins/Actions/ActionsFragment.java | 4 ++-- .../plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 12 ++++++------ .../plugins/OpenAPSMA/OpenAPSMAPlugin.java | 12 ++++++------ .../plugins/OpenAPSSMB/OpenAPSSMBPlugin.java | 12 ++++++------ .../plugins/PumpCombo/ComboPlugin.java | 4 ++-- .../plugins/PumpDanaR/AbstractDanaRPlugin.java | 18 +++++++++--------- .../plugins/PumpInsight/InsightPlugin.java | 4 ++-- .../androidaps/plugins/PumpMDI/MDIPlugin.java | 12 ++++++------ .../plugins/PumpVirtual/VirtualPumpPlugin.java | 12 ++++++------ .../plugins/Wear/ActionStringHandler.java | 16 ++++++++-------- .../wearintegration/WatchUpdaterService.java | 2 +- .../java/info/nightscout/utils/NSUpload.java | 18 +++++++++--------- 12 files changed, 63 insertions(+), 63 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index cc73571b9d..84086d6117 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -158,7 +158,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL if (activeExtendedBolus != null) { extendedBolus.setVisibility(View.GONE); extendedBolusCancel.setVisibility(View.VISIBLE); - extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + activeExtendedBolus.toString()); + extendedBolusCancel.setText(MainApp.gs(R.string.cancel) + " " + activeExtendedBolus.toString()); } else { extendedBolus.setVisibility(View.VISIBLE); extendedBolusCancel.setVisibility(View.GONE); @@ -174,7 +174,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL if (activeTemp != null) { tempBasal.setVisibility(View.GONE); tempBasalCancel.setVisibility(View.VISIBLE); - tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + activeTemp.toStringShort()); + tempBasalCancel.setText(MainApp.gs(R.string.cancel) + " " + activeTemp.toStringShort()); } else { tempBasal.setVisibility(View.VISIBLE); tempBasalCancel.setVisibility(View.GONE); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 17e1dd77e9..143456f6fc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -104,23 +104,23 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface { PumpInterface pump = ConfigBuilderPlugin.getActivePump(); 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) - log.debug(MainApp.instance().getString(R.string.noprofileselected)); + log.debug(MainApp.gs(R.string.noprofileselected)); return; } 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) - log.debug(MainApp.instance().getString(R.string.openapsma_disabled)); + log.debug(MainApp.gs(R.string.openapsma_disabled)); return; } 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) - log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata)); + log.debug(MainApp.gs(R.string.openapsma_noglucosedata)); return; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index 00f1888851..14dac65625 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -104,23 +104,23 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface { PumpInterface pump = ConfigBuilderPlugin.getActivePump(); 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) - log.debug(MainApp.instance().getString(R.string.noprofileselected)); + log.debug(MainApp.gs(R.string.noprofileselected)); return; } 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) - log.debug(MainApp.instance().getString(R.string.openapsma_disabled)); + log.debug(MainApp.gs(R.string.openapsma_disabled)); return; } 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) - log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata)); + log.debug(MainApp.gs(R.string.openapsma_noglucosedata)); return; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java index cd7872ecb1..741adb4dd7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java @@ -107,23 +107,23 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface { PumpInterface pump = ConfigBuilderPlugin.getActivePump(); 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) - log.debug(MainApp.instance().getString(R.string.noprofileselected)); + log.debug(MainApp.gs(R.string.noprofileselected)); return; } 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) - log.debug(MainApp.instance().getString(R.string.openapsma_disabled)); + log.debug(MainApp.gs(R.string.openapsma_disabled)); return; } 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) - log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata)); + log.debug(MainApp.gs(R.string.openapsma_noglucosedata)); return; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 68db1658f6..3cf4557e54 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -458,7 +458,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint log.error("deliverTreatment: Invalid input"); return new PumpEnactResult().success(false).enacted(false) .bolusDelivered(0d).carbsDelivered(0d) - .comment(MainApp.instance().getString(R.string.danar_invalidinput)); + .comment(MainApp.gs(R.string.danar_invalidinput)); } else if (detailedBolusInfo.insulin > 0) { // bolus needed, ask pump to deliver it return deliverBolus(detailedBolusInfo); @@ -474,7 +474,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint return new PumpEnactResult().success(true).enacted(true) .bolusDelivered(0d).carbsDelivered(detailedBolusInfo.carbs) - .comment(MainApp.instance().getString(R.string.virtualpump_resultok)); + .comment(MainApp.gs(R.string.virtualpump_resultok)); } } finally { MainApp.bus().post(new EventComboPumpUpdateGUI()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java index ea83e6d4d6..f3898bc98f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java @@ -166,7 +166,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte result.isTempCancel = false; result.enacted = 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"); return result; } @@ -178,7 +178,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte result.enacted = false; result.success = true; 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.percent = pump.tempBasalPercent; result.isPercent = true; @@ -191,7 +191,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { result.enacted = 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.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; @@ -202,7 +202,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte } result.enacted = 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"); return result; } @@ -219,7 +219,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) { result.enacted = false; 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.absolute = pump.extendedBolusAbsoluteRate; 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) { result.enacted = 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.duration = pump.extendedBolusRemainingMinutes; result.absolute = pump.extendedBolusAbsoluteRate; @@ -245,7 +245,7 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte } result.enacted = 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"); return result; } @@ -261,13 +261,13 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte } if (!pump.isExtendedInProgress) { result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("cancelExtendedBolus: OK"); return result; } else { 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"); return result; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java index c0e53ddaac..54f618158a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java @@ -395,7 +395,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai result.bolusDelivered = detailedBolusInfo.insulin; result.carbsDelivered = detailedBolusInfo.carbs; 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; @@ -796,7 +796,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai } private String gs(int id) { - return MainApp.instance().getString(id); + return MainApp.gs(id); } private boolean isPumpRunning() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java index 9c19a383ae..fed0c01c64 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java @@ -134,7 +134,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface { result.success = true; result.bolusDelivered = detailedBolusInfo.insulin; 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); return result; } @@ -147,7 +147,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface { public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) { PumpEnactResult result = new PumpEnactResult(); result.success = false; - result.comment = MainApp.instance().getString(R.string.pumperror); + result.comment = MainApp.gs(R.string.pumperror); if (Config.logPumpComm) log.debug("Setting temp basal absolute: " + 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) { PumpEnactResult result = new PumpEnactResult(); result.success = false; - result.comment = MainApp.instance().getString(R.string.pumperror); + result.comment = MainApp.gs(R.string.pumperror); if (Config.logPumpComm) log.debug("Settings temp basal percent: " + result); return result; @@ -167,7 +167,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface { public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) { PumpEnactResult result = new PumpEnactResult(); result.success = false; - result.comment = MainApp.instance().getString(R.string.pumperror); + result.comment = MainApp.gs(R.string.pumperror); if (Config.logPumpComm) log.debug("Setting extended bolus: " + result); return result; @@ -177,7 +177,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface { public PumpEnactResult cancelTempBasal(boolean force) { PumpEnactResult result = new PumpEnactResult(); result.success = false; - result.comment = MainApp.instance().getString(R.string.pumperror); + result.comment = MainApp.gs(R.string.pumperror); if (Config.logPumpComm) log.debug("Cancel temp basal: " + result); return result; @@ -187,7 +187,7 @@ public class MDIPlugin extends PluginBase implements PumpInterface { public PumpEnactResult cancelExtendedBolus() { PumpEnactResult result = new PumpEnactResult(); result.success = false; - result.comment = MainApp.instance().getString(R.string.pumperror); + result.comment = MainApp.gs(R.string.pumperror); if (Config.logPumpComm) log.debug("Canceling extended basal: " + result); return result; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index 0491ce0f74..9176ea94b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -202,7 +202,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { result.bolusDelivered = detailedBolusInfo.insulin; result.carbsDelivered = detailedBolusInfo.carbs; 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; @@ -246,7 +246,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { result.isTempCancel = false; result.absolute = absoluteRate; result.duration = durationInMinutes; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal); if (Config.logPumpComm) log.debug("Setting temp basal absolute: " + result); @@ -274,7 +274,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { result.isPercent = true; result.isTempCancel = false; result.duration = durationInMinutes; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); TreatmentsPlugin.getPlugin().addToHistoryTempBasal(tempBasal); if (Config.logPumpComm) log.debug("Settings temp basal percent: " + result); @@ -298,7 +298,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { result.bolusDelivered = insulin; result.isTempCancel = false; result.duration = durationInMinutes; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); TreatmentsPlugin.getPlugin().addToHistoryExtendedBolus(extendedBolus); if (Config.logPumpComm) log.debug("Setting extended bolus: " + result); @@ -312,7 +312,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { PumpEnactResult result = new PumpEnactResult(); result.success = 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()) { result.enacted = true; 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.enacted = true; result.isTempCancel = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpComm) log.debug("Canceling extended basal: " + result); MainApp.bus().post(new EventVirtualPumpUpdateGui()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index fdc14f32d4..bbb1d9122c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -95,9 +95,9 @@ public class ActionStringHandler { return; } 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) - rMessage += "\n" + MainApp.instance().getString(R.string.constraintapllied); + rMessage += "\n" + MainApp.gs(R.string.constraintapllied); rAction += "fill " + insulinAfterConstraints; @@ -106,9 +106,9 @@ public class ActionStringHandler { double amount = SafeParse.stringToDouble(act[1]); 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) - rMessage += "\n" + MainApp.instance().getString(R.string.constraintapllied); + rMessage += "\n" + MainApp.gs(R.string.constraintapllied); rAction += "fill " + insulinAfterConstraints; @@ -118,11 +118,11 @@ public class ActionStringHandler { int carbs = SafeParse.stringToInt(act[2]); Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(insulin)).value(); Integer carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(carbs)).value(); - rMessage += MainApp.instance().getString(R.string.bolus) + ": " + insulinAfterConstraints + "U\n"; - rMessage += MainApp.instance().getString(R.string.carbs) + ": " + carbsAfterConstraints + "g"; + rMessage += MainApp.gs(R.string.bolus) + ": " + insulinAfterConstraints + "U\n"; + rMessage += MainApp.gs(R.string.carbs) + ": " + carbsAfterConstraints + "g"; 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; @@ -283,7 +283,7 @@ public class ActionStringHandler { //if pump is not busy: try to fetch data final PumpInterface pump = MainApp.getConfigBuilder().getActivePump(); if (pump.isBusy()) { - rMessage += MainApp.instance().getString(R.string.pumpbusy); + rMessage += MainApp.gs(R.string.pumpbusy); } else { rMessage += "trying to fetch data from pump."; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index e999a9f4b9..d9bfd55f6b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -578,7 +578,7 @@ public class WatchUpdaterService extends WearableListenerService implements if (googleApiClient.isConnected()) { 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; iobSum = iobDetail = cobString = currentBasal = bgiString = ""; if (profile != null) { diff --git a/app/src/main/java/info/nightscout/utils/NSUpload.java b/app/src/main/java/info/nightscout/utils/NSUpload.java index 3cd252f19a..bfaedc2708 100644 --- a/app/src/main/java/info/nightscout/utils/NSUpload.java +++ b/app/src/main/java/info/nightscout/utils/NSUpload.java @@ -55,7 +55,7 @@ public class NSUpload { if (temporaryBasal.pumpId != 0) data.put("pumpId", temporaryBasal.pumpId); 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) data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization Bundle bundle = new Bundle(); @@ -93,7 +93,7 @@ public class NSUpload { if (temporaryBasal.pumpId != 0) data.put("pumpId", temporaryBasal.pumpId); 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.putString("action", "dbAdd"); bundle.putString("collection", "treatments"); @@ -115,7 +115,7 @@ public class NSUpload { JSONObject data = new JSONObject(); data.put("eventType", CareportalEvent.TEMPBASAL); 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) data.put("isFakedTempBasal", isFakedTempBasal); if (pumpId != 0) @@ -147,7 +147,7 @@ public class NSUpload { if (extendedBolus.pumpId != 0) data.put("pumpId", extendedBolus.pumpId); 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.putString("action", "dbAdd"); bundle.putString("collection", "treatments"); @@ -173,7 +173,7 @@ public class NSUpload { data.put("enteredinsulin", 0); data.put("relative", 0); 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) data.put("pumpId", pumpId); Bundle bundle = new Bundle(); @@ -301,7 +301,7 @@ public class NSUpload { data.put("percentage", profileSwitch.percentage); } 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); } catch (JSONException e) { log.error("Unhandled exception", e); @@ -325,7 +325,7 @@ public class NSUpload { data.put("targetTop", Profile.fromMgdlToUnits(tempTarget.high, profile.getUnits())); data.put("created_at", DateUtil.toISOString(tempTarget.date)); 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); } catch (JSONException e) { log.error("Unhandled exception", e); @@ -346,7 +346,7 @@ public class NSUpload { data.put("percentage", profileSwitch.percentage); } 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) { Context context = MainApp.instance().getApplicationContext(); Bundle bundle = new Bundle(); @@ -420,7 +420,7 @@ public class NSUpload { data.put("eventType", "OpenAPS Offline"); data.put("duration", durationInMinutes); 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.putString("action", "dbAdd"); bundle.putString("collection", "treatments");