Extract some string resources.

This commit is contained in:
Johannes Mockenhaupt 2017-11-22 14:27:29 +01:00
parent cc6c34e46c
commit cf430b84cf
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
5 changed files with 19 additions and 15 deletions

View file

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

View file

@ -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<PumpAlert> 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) {

View file

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

View file

@ -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<Tdd> 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");
}

View file

@ -771,6 +771,7 @@
<string name="combo_last_connection_time">%s</string>
<string name="combo_tbr_remaining">%d%% (%d min remaining)</string>
<string name="combo_last_bolus">%.1f U (%s, %s)</string>
<string name="combo_pump_action_initializing">Initializing</string>
<string name="combo_pump_state_disconnected">Disconnected</string>
<string name="combo_pump_state_suspended_due_to_error">Suspended due to error</string>
<string name="combo_pump_state_suspended_by_user">Suspended by user</string>
@ -788,9 +789,9 @@
<string name="combo_pump_bolus_verification_failed">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.</string>
<string name="combo_pump_unsupported_operation">Requested operation not supported by pump</string>
<string name="combo_bolus_bolus_delivery_failed">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.</string>
<string name="combo_force_disabled">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.</string>
<string name="combo_force_disabled_notification">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.</string>
<string name="combo_notification_check_time_date">Check pump time and date</string>
<string name="bolus_frequency_exceeded">A bolus with the same amount was requested within the last minute. For safety reasons this is disallowed.</string>
<string name="combo_pump_action_initializing">Initializing</string>
<string name="combo_pump_connected_now">Now</string>
<string name="combo_activity_reading_pump_history">Reading pump history</string>
<string name="danar_history">pump history</string>
@ -813,5 +814,7 @@
<string name="key_missed_bg_readings_threshold" translatable="false">missed_bg_readings_threshold</string>
<string name="urgent_alarm">Urgent Alarm</string>
<string name="info">INFO</string>
<string name="combo_empty_alert_history_note">To retrieve the alert history from the pump, long press the Refresh button.</string>
<string name="combo_empty_tdd_history_note">To retrieve the TDD history from the pump, long press the Refresh button.</string>
</resources>