From cf430b84cffaeb892c596f33647f76994a3ecffa Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 22 Nov 2017 14:27:29 +0100 Subject: [PATCH] Extract some string resources. --- .../androidaps/plugins/Actions/ActionsFragment.java | 4 +++- .../plugins/PumpCombo/ComboAlertHistoryDialog.java | 9 ++++----- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 4 ++-- .../plugins/PumpCombo/ComboTddHistoryDialog.java | 10 +++++----- app/src/main/res/values/strings.xml | 7 +++++-- 5 files changed, 19 insertions(+), 15 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 aab7c9a4b4..65c3e63493 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 @@ -189,7 +189,9 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL @Override public void onClick(View view) { - FragmentManager manager = getChildFragmentManager(); + FragmentManager manager = getFragmentManager(); +// TODO this might fix some crashes ..., let's see if they re-appear with this disabled again +// FragmentManager manager = getChildFragmentManager(); final PumpInterface pump = MainApp.getConfigBuilder(); switch (view.getId()) { case R.id.actions_profileswitch: diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboAlertHistoryDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboAlertHistoryDialog.java index 7096a098a3..f9b7c968f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboAlertHistoryDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboAlertHistoryDialog.java @@ -7,7 +7,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import java.text.SimpleDateFormat; +import java.text.DateFormat; import java.util.List; import de.jotomo.ruffy.spi.history.PumpAlert; @@ -20,10 +20,9 @@ public class ComboAlertHistoryDialog extends DialogFragment { TextView text = (TextView) layout.findViewById(R.id.combo_error_history_text); List errors = ComboPlugin.getPlugin().getPump().errorHistory; StringBuilder sb = new StringBuilder(); - // TODO i18n - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM. HH:mm"); + DateFormat dateFormatter = DateFormat.getDateInstance(); if (errors.isEmpty()) { - text.setText("To retrieve the alert history from the pump, long press the Refresh button."); + text.setText(R.string.combo_empty_alert_history_note); } else { boolean first = true; for (PumpAlert error : errors) { @@ -32,7 +31,7 @@ public class ComboAlertHistoryDialog extends DialogFragment { } else { sb.append("\n"); } - sb.append(simpleDateFormat.format(error.timestamp)); + sb.append(dateFormatter.format(error.timestamp)); sb.append(" "); sb.append(error.message); if (error.warningCode != null) { 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 5a685ffea9..b26643180b 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 @@ -691,7 +691,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf Date now = new Date(); int minutesOfDayNow = now.getHours() * 60 + now.getMinutes(); if ((Math.abs(preCheckResult.state.pumpTimeMinutesOfDay - minutesOfDayNow) > 3)) { - Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, "Check pump clock", Notification.NORMAL); + Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.sResources.getString(R.string.combo_notification_check_time_date), Notification.NORMAL); MainApp.bus().post(new EventNewNotification(notification)); // runCommand("Updating pump clock", 2, ruffyScripter::setDateAndTime); } @@ -732,7 +732,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf closedLoopDisabledUntil = lastViolation + 6 * 60 * 60 * 1000; if (closedLoopDisabledUntil > System.currentTimeMillis() && violationWarningRaisedFor != closedLoopDisabledUntil) { Notification n = new Notification(Notification.COMBO_PUMP_ALARM, - MainApp.sResources.getString(R.string.combo_force_disabled), + MainApp.sResources.getString(R.string.combo_force_disabled_notification), Notification.URGENT); n.soundId = R.raw.alarm; MainApp.bus().post(new EventNewNotification(n)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java index ea06afbb25..4af521ff29 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java @@ -7,7 +7,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import java.text.SimpleDateFormat; +import java.text.DateFormat; import java.util.List; import de.jotomo.ruffy.spi.history.Tdd; @@ -20,10 +20,9 @@ public class ComboTddHistoryDialog extends DialogFragment { TextView text = (TextView) layout.findViewById(R.id.combo_tdd_history_text); List tdds = ComboPlugin.getPlugin().getPump().tddHistory; StringBuilder sb = new StringBuilder(); - // TODO i18n - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM."); + DateFormat dateFormatter = DateFormat.getDateInstance(); if (tdds.isEmpty()) { - text.setText("To retrieve the TDD history from the pump, long press the Refresh button."); + text.setText(R.string.combo_empty_tdd_history_note); } else { boolean first = true; for (Tdd tdd : tdds) { @@ -32,8 +31,9 @@ public class ComboTddHistoryDialog extends DialogFragment { } else { sb.append("\n"); } - sb.append(simpleDateFormat.format(tdd.timestamp)); + sb.append(dateFormatter.format(tdd.timestamp)); sb.append(" "); + // TODO i18n sb.append(String.format("%.1f", tdd.total)); sb.append(" U"); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29b45b3684..be718b14fb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -771,6 +771,7 @@ %s %d%% (%d min remaining) %.1f U (%s, %s) + Initializing Disconnected Suspended due to error Suspended by user @@ -788,9 +789,9 @@ Bolus delivery verification failed. The pump history will be read again on the next loop run or when refreshing from the Combo page. Please check and bolus again if needed. Requested operation not supported by pump Bolus delivery failed. A (partial) bolus might have been delivered. Attempting to update history from pump. Please check the Combo page and bolus again as needed. - Unsafe usage: extended or multiwave boluses have been delivered within the last 6 hours or the selected basal rate is not 1. Loop mode has been disabled until 6 hours after the last unsupported bolus or basal rate profile. Only normal boluses are supported in loop mode with basal rate profile 1. + Unsafe usage: extended or multiwave boluses have been delivered within the last 6 hours or the selected basal rate is not 1. Loop mode has been disabled until 6 hours after the last unsupported bolus or basal rate profile. Only normal boluses are supported in loop mode with basal rate profile 1. + Check pump time and date A bolus with the same amount was requested within the last minute. For safety reasons this is disallowed. - Initializing Now Reading pump history pump history @@ -813,5 +814,7 @@ missed_bg_readings_threshold Urgent Alarm INFO + To retrieve the alert history from the pump, long press the Refresh button. + To retrieve the TDD history from the pump, long press the Refresh button.