diff --git a/src/ui/mvg_screen.cpp b/src/ui/mvg_screen.cpp index a785db5..4425a05 100644 --- a/src/ui/mvg_screen.cpp +++ b/src/ui/mvg_screen.cpp @@ -41,29 +41,42 @@ void buildList() { lv_obj_set_style_pad_all(row, 6, 0); lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE); - String badge = String(dep.icon) + " " + dep.line; - lv_obj_t *ln = lv_label_create(row); - lv_label_set_text(ln, badge.c_str()); - lv_obj_set_style_text_color(ln, typeColor(dep.type), 0); - lv_obj_align(ln, LV_ALIGN_TOP_LEFT, 0, 0); + // Zeile 1 links: Icon in Farbe, Linie in Weiß + lv_obj_t *icon = lv_label_create(row); + lv_label_set_text(icon, dep.icon.c_str()); + lv_obj_set_style_text_color(icon, typeColor(dep.type), 0); + lv_obj_align(icon, LV_ALIGN_TOP_LEFT, 0, 0); + lv_obj_t *ln = lv_label_create(row); + lv_label_set_text(ln, dep.line.c_str()); + lv_obj_set_style_text_color(ln, Theme::text(), 0); + lv_obj_align_to(ln, icon, LV_ALIGN_OUT_RIGHT_MID, 4, 0); + + // Zeile 1 rechts: Zeit + Verspätung + if (dep.cancelled) { + lv_obj_t *t = lv_label_create(row); + lv_label_set_text(t, "Ausfall"); + lv_obj_set_style_text_color(t, Theme::accentError(), 0); + lv_obj_align(t, LV_ALIGN_TOP_RIGHT, 0, 0); + } else { + lv_obj_t *t = lv_label_create(row); + lv_label_set_text(t, dep.timeStr.c_str()); + lv_obj_set_style_text_color(t, Theme::text(), 0); + lv_obj_align(t, LV_ALIGN_TOP_RIGHT, 0, 0); + + if (dep.delayMin > 0) { + lv_obj_t *delay = lv_label_create(row); + lv_label_set_text(delay, ("+" + String(dep.delayMin)).c_str()); + lv_obj_set_style_text_color(delay, Theme::accentError(), 0); + lv_obj_align_to(delay, t, LV_ALIGN_OUT_RIGHT_MID, 2, 0); + } + } + + // Zeile 2: Richtung String dest = sanitizeGermanText(dep.destination.substring(0, 20)); lv_obj_t *d = lv_label_create(row); lv_label_set_text(d, dest.c_str()); - lv_obj_align(d, LV_ALIGN_TOP_LEFT, 0, 18); - - String right; - if (dep.cancelled) { - right = "Ausfall"; - } else { - right = dep.timeStr; - if (dep.delayMin > 0) right += " +" + String(dep.delayMin); - } - lv_obj_t *t = lv_label_create(row); - lv_label_set_text(t, right.c_str()); - lv_obj_set_style_text_color(t, - dep.cancelled ? Theme::accentError() : Theme::text(), 0); - lv_obj_align(t, LV_ALIGN_TOP_RIGHT, 0, 18); + lv_obj_align(d, LV_ALIGN_TOP_LEFT, 0, 20); } }