Dialog cleanups.

This commit is contained in:
Johannes Mockenhaupt 2017-11-12 18:36:42 +01:00
parent f2569b587a
commit ef0c5b9138
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 14 additions and 4 deletions

View file

@ -25,9 +25,15 @@ public class ComboErrorHistoryDialog extends DialogFragment {
StringBuilder sb = new StringBuilder();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM. HH:mm");
if (errors.isEmpty()) {
text.setText("No errors. To retrieve the error history from the pump, long press the Refresh button.");
text.setText("To retrieve the error history from the pump, long press the Refresh button.");
} else {
boolean first = true;
for (PumpError error : errors) {
if (first) {
first = false;
} else {
sb.append("\n");
}
sb.append(simpleDateFormat.format(error.timestamp));
sb.append(" ");
sb.append(error.message);
@ -41,7 +47,6 @@ public class ComboErrorHistoryDialog extends DialogFragment {
sb.append(error.errorCode);
sb.append(")");
}
sb.append("\n");
}
text.setText(sb.toString());
}

View file

@ -25,14 +25,19 @@ public class ComboTddHistoryDialog extends DialogFragment {
StringBuilder sb = new StringBuilder();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.");
if (tdds.isEmpty()) {
text.setText("No TDDs. To retrieve the TDD history from the pump, long press the Refresh button.");
text.setText("To retrieve the TDD history from the pump, long press the Refresh button.");
} else {
boolean first = true;
for (Tdd tdd : tdds) {
if (first) {
first = false;
} else {
sb.append("\n");
}
sb.append(simpleDateFormat.format(tdd.timestamp));
sb.append(" ");
sb.append(String.format("%.1f", tdd.total));
sb.append(" U");
sb.append("\n");
}
text.setText(sb.toString());
}