Slightly improve the dialogs.

This commit is contained in:
Johannes Mockenhaupt 2017-11-22 14:48:05 +01:00
parent cf430b84cf
commit 9f946229bc
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 7 additions and 7 deletions

View file

@ -19,11 +19,11 @@ public class ComboAlertHistoryDialog extends DialogFragment {
View layout = inflater.inflate(R.layout.combo_alert_history_fragment, container, false);
TextView text = (TextView) layout.findViewById(R.id.combo_error_history_text);
List<PumpAlert> errors = ComboPlugin.getPlugin().getPump().errorHistory;
StringBuilder sb = new StringBuilder();
DateFormat dateFormatter = DateFormat.getDateInstance();
if (errors.isEmpty()) {
text.setText(R.string.combo_empty_alert_history_note);
} else {
StringBuilder sb = new StringBuilder();
DateFormat dateTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
boolean first = true;
for (PumpAlert error : errors) {
if (first) {
@ -31,7 +31,7 @@ public class ComboAlertHistoryDialog extends DialogFragment {
} else {
sb.append("\n");
}
sb.append(dateFormatter.format(error.timestamp));
sb.append(dateTimeFormatter.format(error.timestamp));
sb.append(" ");
sb.append(error.message);
if (error.warningCode != null) {

View file

@ -9,6 +9,7 @@ import android.widget.TextView;
import java.text.DateFormat;
import java.util.List;
import java.util.Locale;
import de.jotomo.ruffy.spi.history.Tdd;
import info.nightscout.androidaps.R;
@ -19,12 +20,12 @@ public class ComboTddHistoryDialog extends DialogFragment {
View layout = inflater.inflate(R.layout.combo_tdd_history_fragment, container, false);
TextView text = (TextView) layout.findViewById(R.id.combo_tdd_history_text);
List<Tdd> tdds = ComboPlugin.getPlugin().getPump().tddHistory;
StringBuilder sb = new StringBuilder();
DateFormat dateFormatter = DateFormat.getDateInstance();
if (tdds.isEmpty()) {
text.setText(R.string.combo_empty_tdd_history_note);
} else {
boolean first = true;
StringBuilder sb = new StringBuilder();
DateFormat dateFormatter = DateFormat.getDateInstance();
for (Tdd tdd : tdds) {
if (first) {
first = false;
@ -33,8 +34,7 @@ public class ComboTddHistoryDialog extends DialogFragment {
}
sb.append(dateFormatter.format(tdd.timestamp));
sb.append(" ");
// TODO i18n
sb.append(String.format("%.1f", tdd.total));
sb.append(String.format(Locale.getDefault(), "%3.1f", tdd.total));
sb.append(" U");
}
text.setText(sb.toString());