Slightly improve the dialogs.
This commit is contained in:
parent
cf430b84cf
commit
9f946229bc
|
@ -19,11 +19,11 @@ public class ComboAlertHistoryDialog extends DialogFragment {
|
||||||
View layout = inflater.inflate(R.layout.combo_alert_history_fragment, container, false);
|
View layout = inflater.inflate(R.layout.combo_alert_history_fragment, container, false);
|
||||||
TextView text = (TextView) layout.findViewById(R.id.combo_error_history_text);
|
TextView text = (TextView) layout.findViewById(R.id.combo_error_history_text);
|
||||||
List<PumpAlert> errors = ComboPlugin.getPlugin().getPump().errorHistory;
|
List<PumpAlert> errors = ComboPlugin.getPlugin().getPump().errorHistory;
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
DateFormat dateFormatter = DateFormat.getDateInstance();
|
|
||||||
if (errors.isEmpty()) {
|
if (errors.isEmpty()) {
|
||||||
text.setText(R.string.combo_empty_alert_history_note);
|
text.setText(R.string.combo_empty_alert_history_note);
|
||||||
} else {
|
} else {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
DateFormat dateTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (PumpAlert error : errors) {
|
for (PumpAlert error : errors) {
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@ -31,7 +31,7 @@ public class ComboAlertHistoryDialog extends DialogFragment {
|
||||||
} else {
|
} else {
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
sb.append(dateFormatter.format(error.timestamp));
|
sb.append(dateTimeFormatter.format(error.timestamp));
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(error.message);
|
sb.append(error.message);
|
||||||
if (error.warningCode != null) {
|
if (error.warningCode != null) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import de.jotomo.ruffy.spi.history.Tdd;
|
import de.jotomo.ruffy.spi.history.Tdd;
|
||||||
import info.nightscout.androidaps.R;
|
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);
|
View layout = inflater.inflate(R.layout.combo_tdd_history_fragment, container, false);
|
||||||
TextView text = (TextView) layout.findViewById(R.id.combo_tdd_history_text);
|
TextView text = (TextView) layout.findViewById(R.id.combo_tdd_history_text);
|
||||||
List<Tdd> tdds = ComboPlugin.getPlugin().getPump().tddHistory;
|
List<Tdd> tdds = ComboPlugin.getPlugin().getPump().tddHistory;
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
DateFormat dateFormatter = DateFormat.getDateInstance();
|
|
||||||
if (tdds.isEmpty()) {
|
if (tdds.isEmpty()) {
|
||||||
text.setText(R.string.combo_empty_tdd_history_note);
|
text.setText(R.string.combo_empty_tdd_history_note);
|
||||||
} else {
|
} else {
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
DateFormat dateFormatter = DateFormat.getDateInstance();
|
||||||
for (Tdd tdd : tdds) {
|
for (Tdd tdd : tdds) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -33,8 +34,7 @@ public class ComboTddHistoryDialog extends DialogFragment {
|
||||||
}
|
}
|
||||||
sb.append(dateFormatter.format(tdd.timestamp));
|
sb.append(dateFormatter.format(tdd.timestamp));
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
// TODO i18n
|
sb.append(String.format(Locale.getDefault(), "%3.1f", tdd.total));
|
||||||
sb.append(String.format("%.1f", tdd.total));
|
|
||||||
sb.append(" U");
|
sb.append(" U");
|
||||||
}
|
}
|
||||||
text.setText(sb.toString());
|
text.setText(sb.toString());
|
||||||
|
|
Loading…
Reference in a new issue