From 926ee535d54321f6b02278eea41656f222a69304 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Wed, 2 May 2018 14:28:16 +0200 Subject: [PATCH] use MainApp.gs instead of context 2 --- .../plugins/ConstraintsObjectives/ObjectivesFragment.java | 2 +- .../Treatments/fragments/TreatmentsBolusFragment.java | 8 ++++---- .../fragments/TreatmentsCareportalFragment.java | 8 ++++---- .../fragments/TreatmentsProfileSwitchFragment.java | 8 ++++---- .../fragments/TreatmentsTempTargetFragment.java | 8 ++++---- .../plugins/XDripStatusline/StatuslinePlugin.java | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java index ccb3474358..1424013440 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java @@ -59,7 +59,7 @@ public class ObjectivesFragment extends SubscriberFragment { holder.position.setText(String.valueOf(position + 1)); holder.objective.setText(o.objective); holder.gate.setText(o.gate); - holder.duration.setText(context.getString(R.string.objectives_minimalduration) + " " + o.durationInDays + " " + context.getString(R.string.days)); + holder.duration.setText(MainApp.gs(R.string.objectives_minimalduration) + " " + o.durationInDays + " " + MainApp.gs(R.string.days)); holder.progress.setText(requirementsMet.comment); holder.started.setText(o.started.toLocaleString()); holder.accomplished.setText(o.accomplished.toLocaleString()); 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 dfb918406e..57ad6833a9 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 @@ -204,16 +204,16 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View. switch (view.getId()) { case R.id.treatments_reshreshfromnightscout: AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext()); - builder.setTitle(this.getContext().getString(R.string.confirmation)); - builder.setMessage(this.getContext().getString(R.string.refresheventsfromnightscout) + "?"); - builder.setPositiveButton(this.getContext().getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + "?"); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { TreatmentsPlugin.getPlugin().getService().resetTreatments(); Intent restartNSClient = new Intent(Intents.ACTION_RESTART); MainApp.instance().getApplicationContext().sendBroadcast(restartNSClient); } }); - builder.setNegativeButton(this.getContext().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 0eed8b1163..97c3a05274 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 @@ -157,16 +157,16 @@ public class TreatmentsCareportalFragment extends SubscriberFragment implements switch (view.getId()) { case R.id.careportal_refreshfromnightscout: AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext()); - builder.setTitle(this.getContext().getString(R.string.confirmation)); - builder.setMessage(this.getContext().getString(R.string.refresheventsfromnightscout) + " ?"); - builder.setPositiveButton(this.getContext().getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + " ?"); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { MainApp.getDbHelper().resetCareportalEvents(); Intent restartNSClient = new Intent(Intents.ACTION_RESTART); MainApp.instance().getApplicationContext().sendBroadcast(restartNSClient); } }); - builder.setNegativeButton(this.getContext().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/TreatmentsProfileSwitchFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsProfileSwitchFragment.java index af8846662c..307f9c8ee6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsProfileSwitchFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsProfileSwitchFragment.java @@ -190,16 +190,16 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen switch (view.getId()) { case R.id.profileswitch_refreshfromnightscout: AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext()); - builder.setTitle(this.getContext().getString(R.string.confirmation)); - builder.setMessage(this.getContext().getString(R.string.refresheventsfromnightscout) + "?"); - builder.setPositiveButton(this.getContext().getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + "?"); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { MainApp.getDbHelper().resetProfileSwitch(); Intent restartNSClient = new Intent(Intents.ACTION_RESTART); MainApp.instance().getApplicationContext().sendBroadcast(restartNSClient); } }); - builder.setNegativeButton(this.getContext().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/TreatmentsTempTargetFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java index 0156df16e8..df67349839 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java @@ -192,16 +192,16 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements switch (view.getId()) { case R.id.temptargetrange_refreshfromnightscout: AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext()); - builder.setTitle(this.getContext().getString(R.string.confirmation)); - builder.setMessage(this.getContext().getString(R.string.refresheventsfromnightscout) + " ?"); - builder.setPositiveButton(this.getContext().getString(R.string.ok), new DialogInterface.OnClickListener() { + builder.setTitle(MainApp.gs(R.string.confirmation)); + builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + " ?"); + builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { MainApp.getDbHelper().resetTempTargets(); Intent restartNSClient = new Intent(Intents.ACTION_RESTART); MainApp.instance().getApplicationContext().sendBroadcast(restartNSClient); } }); - builder.setNegativeButton(this.getContext().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/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index 426acbe6ca..03c6c48a1a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -113,7 +113,7 @@ public class StatuslinePlugin extends PluginBase { LoopPlugin loopPlugin = LoopPlugin.getPlugin(); if (!loopPlugin.isEnabled(PluginType.LOOP)) { - status += ctx.getString(R.string.disabledloop) + "\n"; + status += MainApp.gs(R.string.disabledloop) + "\n"; lastLoopStatus = false; } else if (loopPlugin.isEnabled(PluginType.LOOP)) { lastLoopStatus = true;