diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java index ac31d2df92..05c4087dcb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgHistoryEvents_v2.java @@ -170,6 +170,6 @@ public class MsgHistoryEvents_v2 extends MessageBase { if (datetime.getTime() > lastEventTimeLoaded) lastEventTimeLoaded = datetime.getTime(); - MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.processinghistory) + ": " + status)); + MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.processinghistory) + ": " + status)); } } 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 54f618158a..824a449f38 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 @@ -320,9 +320,9 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai PumpEnactResult result = new PumpEnactResult(); if (!isInitialized()) { 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)); - result.comment = MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet); + result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet); return result; } MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); @@ -339,16 +339,16 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai final Mstatus ms = async.busyWaitForCommandResult(uuid, BUSY_WAIT_TIME); if (ms.success()) { 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)); result.success = true; result.enacted = true; result.comment = "OK"; this.profileBlocks = profileBlocks; } else { - 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)); - result.comment = MainApp.sResources.getString(R.string.failedupdatebasalprofile); + result.comment = MainApp.gs(R.string.failedupdatebasalprofile); } return result; } @@ -425,7 +425,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai t.isSMB = detailedBolusInfo.isSMB; final EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance(); bolusingEvent.t = t; - bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), 0F); + bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), 0F); bolusingEvent.bolusId = bolusId; bolusingEvent.percent = 0; MainApp.bus().post(bolusingEvent); @@ -464,7 +464,7 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai if (activeBolus == null) break; else { bolusingEvent.percent = (int) (100D / activeBolus.getInitialAmount() * (activeBolus.getInitialAmount() - activeBolus.getLeftoverAmount())); - bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), activeBolus.getInitialAmount() - activeBolus.getLeftoverAmount()); + bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), activeBolus.getInitialAmount() - activeBolus.getLeftoverAmount()); MainApp.bus().post(bolusingEvent); } } else break; 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 9176ea94b5..34d3fee80b 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 @@ -171,7 +171,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { // Do nothing here. we are using MainApp.getConfigBuilder().getActiveProfile().getProfile(); PumpEnactResult result = new PumpEnactResult(); result.success = true; - 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)); return result; } @@ -209,14 +209,14 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { while (delivering < detailedBolusInfo.insulin) { SystemClock.sleep(200); EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance(); - bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), delivering); + bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), delivering); bolusingEvent.percent = Math.min((int) (delivering / detailedBolusInfo.insulin * 100), 100); MainApp.bus().post(bolusingEvent); delivering += 0.1d; } SystemClock.sleep(200); EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance(); - bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivered), detailedBolusInfo.insulin); + bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivered), detailedBolusInfo.insulin); bolusingEvent.percent = 100; MainApp.bus().post(bolusingEvent); SystemClock.sleep(1000); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/BGSourceFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/BGSourceFragment.java index 7e959b78d4..3e9a79d459 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/BGSourceFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/BGSourceFragment.java @@ -143,9 +143,9 @@ public class BGSourceFragment extends SubscriberFragment { case R.id.bgsource_remove: AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); - builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); - builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(profile.getUnits())); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(profile.getUnits())); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { /* final String _id = bgReading._id; if (NSUpload.isIdValid(_id)) { @@ -159,7 +159,7 @@ public class BGSourceFragment extends SubscriberFragment { updateGUI(); } }); - builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); + builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.show(); break; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsBolusFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsBolusFragment.java index ae977d4024..dfb918406e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsBolusFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsBolusFragment.java @@ -81,7 +81,7 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View. Iob iob = t.iobCalc(System.currentTimeMillis(), profile.getDia()); holder.iob.setText(DecimalFormatter.to2Decimal(iob.iobContrib) + " U"); holder.activity.setText(DecimalFormatter.to3Decimal(iob.activityContrib) + " U"); - holder.mealOrCorrection.setText(t.isSMB ? "SMB" : t.mealBolus ? MainApp.sResources.getString(R.string.mealbolus) : MainApp.sResources.getString(R.string.correctionbous)); + holder.mealOrCorrection.setText(t.isSMB ? "SMB" : t.mealBolus ? MainApp.gs(R.string.mealbolus) : MainApp.gs(R.string.correctionbous)); holder.ph.setVisibility(t.source == Source.PUMP ? View.VISIBLE : View.GONE); holder.ns.setVisibility(NSUpload.isIdValid(t._id) ? View.VISIBLE : View.GONE); holder.invalid.setVisibility(t.isValid ? View.GONE : View.VISIBLE); @@ -142,9 +142,9 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View. switch (v.getId()) { case R.id.treatments_remove: AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); - builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(treatment.date)); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(treatment.date)); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final String _id = treatment._id; if (treatment.source == Source.PUMP) { @@ -162,7 +162,7 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View. FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTreatment")); } }); - builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); + builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.show(); break; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsCareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsCareportalFragment.java index 7218198b43..0eed8b1163 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsCareportalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsCareportalFragment.java @@ -105,9 +105,9 @@ public class TreatmentsCareportalFragment extends SubscriberFragment implements switch (v.getId()) { case R.id.careportal_remove: AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); - builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(careportalEvent.date)); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(careportalEvent.date)); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final String _id = careportalEvent._id; if (NSUpload.isIdValid(_id)) { @@ -118,7 +118,7 @@ public class TreatmentsCareportalFragment extends SubscriberFragment implements MainApp.getDbHelper().delete(careportalEvent); } }); - builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); + builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.show(); break; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java index c8fc539d02..05e18bfdc3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java @@ -67,7 +67,7 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment { holder.ns.setVisibility(NSUpload.isIdValid(extendedBolus._id) ? View.VISIBLE : View.GONE); if (extendedBolus.isEndingEvent()) { holder.date.setText(DateUtil.dateAndTimeString(extendedBolus.date)); - holder.duration.setText(MainApp.sResources.getString(R.string.cancel)); + holder.duration.setText(MainApp.gs(R.string.cancel)); holder.insulin.setText(""); holder.realDuration.setText(""); holder.iob.setText(""); @@ -144,9 +144,9 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment { switch (v.getId()) { case R.id.extendedboluses_remove: AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); - builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(extendedBolus.date)); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(extendedBolus.date)); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final String _id = extendedBolus._id; if (NSUpload.isIdValid(_id)) { @@ -158,7 +158,7 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment { FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus")); } }); - builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); + builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.show(); break; } 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 bbb1d9122c..aca5100fb6 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 @@ -513,15 +513,15 @@ public class ActionStringHandler { } if (!result.isChangeRequested()) { - ret += MainApp.sResources.getString(R.string.nochangerequested) + "\n"; + ret += MainApp.gs(R.string.nochangerequested) + "\n"; } else if (result.rate == 0 && result.duration == 0) { - ret += MainApp.sResources.getString(R.string.canceltemp) + "\n"; + ret += MainApp.gs(R.string.canceltemp) + "\n"; } else { - ret += MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(result.rate) + " U/h " + + ret += MainApp.gs(R.string.rate) + ": " + DecimalFormatter.to2Decimal(result.rate) + " U/h " + "(" + DecimalFormatter.to2Decimal(result.rate / ConfigBuilderPlugin.getActivePump().getBaseBasalRate() * 100) + "%)\n" + - MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to0Decimal(result.duration) + " min\n"; + MainApp.gs(R.string.duration) + ": " + DecimalFormatter.to0Decimal(result.duration) + " min\n"; } - ret += "\n" + MainApp.sResources.getString(R.string.reason) + ": " + result.reason; + ret += "\n" + MainApp.gs(R.string.reason) + ": " + result.reason; return ret; } @@ -586,18 +586,18 @@ public class ActionStringHandler { //check for validity if (percentage < Constants.CPP_MIN_PERCENTAGE || percentage > Constants.CPP_MAX_PERCENTAGE) { - msg += String.format(MainApp.sResources.getString(R.string.valueoutofrange), "Profile-Percentage") + "\n"; + msg += String.format(MainApp.gs(R.string.valueoutofrange), "Profile-Percentage") + "\n"; } if (timeshift < 0 || timeshift > 23) { - msg += String.format(MainApp.sResources.getString(R.string.valueoutofrange), "Profile-Timeshift") + "\n"; + msg += String.format(MainApp.gs(R.string.valueoutofrange), "Profile-Timeshift") + "\n"; } final Profile profile = MainApp.getConfigBuilder().getProfile(); if (profile == null) { - msg += MainApp.sResources.getString(R.string.notloadedplugins) + "\n"; + msg += MainApp.gs(R.string.notloadedplugins) + "\n"; } if (!"".equals(msg)) { - msg += MainApp.sResources.getString(R.string.valuesnotstored); + msg += MainApp.gs(R.string.valuesnotstored); String rTitle = "STATUS"; String rAction = "statusmessage"; WearPlugin.getPlugin().requestActionConfirmation(rTitle, msg, rAction); @@ -634,7 +634,7 @@ public class ActionStringHandler { @Override public void run() { if (!result.success) { - sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) + + sendError(MainApp.gs(R.string.treatmentdeliveryerror) + "\n" + result.comment); } @@ -652,7 +652,7 @@ public class ActionStringHandler { @Override public void run() { if (!result.success) { - sendError(MainApp.sResources.getString(R.string.treatmentdeliveryerror) + + sendError(MainApp.gs(R.string.treatmentdeliveryerror) + "\n" + result.comment); } 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 d9bfd55f6b..592f89d568 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 @@ -661,7 +661,7 @@ public class WatchUpdaterService extends WearableListenerService implements String status = ""; if (profile == null) { - status = MainApp.sResources.getString(R.string.noprofile); + status = MainApp.gs(R.string.noprofile); return status; }