use MainApp.gs instead of context 2

This commit is contained in:
AdrianLxM 2018-05-02 14:28:16 +02:00
parent d289c5c7d7
commit 926ee535d5
6 changed files with 18 additions and 18 deletions

View file

@ -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());

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;