more UI fixes

This commit is contained in:
2026-08-02 15:01:55 +02:00
parent b04d5f6ee8
commit 1005b4434c
3 changed files with 25 additions and 18 deletions
+5 -4
View File
@@ -39,26 +39,27 @@ void buildList() {
lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE);
// Shared base: ensure no default-black text leaks through to children.
lv_obj_set_style_text_color(row, Theme::text(), 0);
lv_obj_set_style_text_color(row, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_t *date = lv_label_create(row);
lv_label_set_text(date, DateUtils::formatDateDE(ev.startAt).c_str());
lv_obj_set_style_text_color(date, Theme::textDim(), 0);
lv_obj_set_style_text_color(date, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_width(date, 72);
lv_obj_align(date, LV_ALIGN_TOP_LEFT, 0, 0);
lv_obj_t *time = lv_label_create(row);
lv_label_set_text(time, DateUtils::formatTimeDE(ev.startAt, ev.allDay).c_str());
lv_obj_set_style_text_color(time, Theme::accentCalendar(), 0);
lv_obj_set_style_text_color(time, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_obj_set_style_text_align(time, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_set_width(time, 56);
lv_obj_align(time, LV_ALIGN_TOP_LEFT, 80, 0);
lv_obj_t *sum = lv_label_create(row);
lv_label_set_text(sum, sanitizeGermanText(ev.summary.substring(0, 30)).c_str());
lv_obj_set_style_text_color(sum, Theme::text(), 0);
lv_obj_set_style_text_color(sum, lv_color_hex(0xFFFFFF), LV_PART_MAIN);
lv_label_set_long_mode(sum, LV_LABEL_LONG_MODE_WRAP);
lv_obj_set_width(sum, 124);
lv_obj_set_height(sum, LV_SIZE_CONTENT);
lv_obj_align(sum, LV_ALIGN_TOP_LEFT, 144, 0);
}
}
+18 -12
View File
@@ -17,19 +17,27 @@ unsigned long lastFetchMs = 0;
const unsigned long REFRESH_INTERVAL_MS = 60UL * 1000UL;
lv_color_t typeColor(const String &type) {
String t = type;
t.toUpperCase();
if (t.indexOf("U") >= 0 && t.indexOf("BAHN") >= 0) return Theme::accentUBahn();
if (t.indexOf("S") >= 0 && t.indexOf("BAHN") >= 0) return Theme::accentSBahn();
if (type == "UBAHN") return Theme::accentUBahn();
if (type == "SBAHN") return Theme::accentSBahn();
return Theme::textDim();
}
void styleRow(lv_obj_t *row) {
lv_obj_remove_style_all(row);
lv_obj_set_size(row, 280, LV_SIZE_CONTENT);
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, 0);
lv_obj_set_style_border_width(row, 0, 0);
lv_obj_set_style_pad_all(row, 6, 0);
lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE);
}
void buildList() {
if (!list) return;
lv_obj_clean(list);
if (!ok) {
lv_obj_t *lbl = lv_label_create(list);
lv_obj_remove_style_all(lbl);
lv_label_set_text(lbl, LV_SYMBOL_WARNING " Keine Verbindung");
lv_obj_set_style_text_color(lbl, Theme::accentError(), 0);
return;
@@ -37,23 +45,20 @@ void buildList() {
for (const auto &dep : lastData.departures) {
lv_obj_t *row = lv_obj_create(list);
lv_obj_set_size(row, 280, LV_SIZE_CONTENT);
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, 0);
lv_obj_set_style_border_width(row, 0, 0);
lv_obj_set_style_pad_all(row, 6, 0);
lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_style_text_color(row, Theme::text(), 0);
styleRow(row);
String badge = String(dep.icon) + " " + dep.line;
lv_obj_t *ln = lv_label_create(row);
lv_obj_remove_style_all(ln);
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);
String dest = sanitizeGermanText(dep.destination.substring(0, 20));
lv_obj_t *d = lv_label_create(row);
lv_obj_remove_style_all(d);
lv_label_set_text(d, dest.c_str());
lv_obj_set_style_text_color(d, lv_color_hex(0xFFFFFF), 0);
lv_obj_set_style_text_color(d, Theme::text(), 0);
lv_obj_align(d, LV_ALIGN_TOP_LEFT, 0, 18);
String right;
@@ -64,6 +69,7 @@ void buildList() {
if (dep.delayMin > 0) right += " +" + String(dep.delayMin);
}
lv_obj_t *t = lv_label_create(row);
lv_obj_remove_style_all(t);
lv_label_set_text(t, right.c_str());
lv_obj_set_style_text_color(t,
dep.cancelled ? Theme::accentError() : Theme::text(), 0);
@@ -84,13 +90,13 @@ void mvgScreen_setNavigator(ScreenId (*nav)(ScreenId)) { g_navigate = nav; }
void mvgScreen_create(Screen &s) {
list = lv_obj_create(s.root);
lv_obj_remove_style_all(list);
lv_obj_set_pos(list, 0, 0);
lv_obj_set_size(list, 320, 480 - 80);
lv_obj_set_style_bg_color(list, Theme::bg(), 0);
lv_obj_set_style_bg_opa(list, LV_OPA_COVER, 0);
lv_obj_set_style_border_width(list, 0, 0);
lv_obj_set_style_pad_all(list, 0, 0);
lv_obj_set_style_text_color(list, Theme::text(), 0);
lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN);
lv_obj_add_flag(list, LV_OBJ_FLAG_SCROLLABLE);
back_button_create(s.root, on_back, nullptr);
+2 -2
View File
@@ -58,13 +58,13 @@ void buildList() {
// time column
lv_obj_t *time_label = lv_label_create(row);
lv_label_set_text(time_label, hhmm.c_str());
lv_obj_set_style_text_color(time_label, Theme::text(), 0);
lv_obj_set_style_text_color(time_label, lv_color_hex(0xFFFFFF), 0);
lv_obj_align(time_label, LV_ALIGN_TOP_LEFT, 44, 0);
// degree column
lv_obj_t *temp_label = lv_label_create(row);
lv_label_set_text(temp_label, (String(fe.temperature) + "C").c_str());
lv_obj_set_style_text_color(temp_label, Theme::text(), 0);
lv_obj_set_style_text_color(temp_label, lv_color_hex(0xFFFFFF), 0);
lv_obj_align(temp_label, LV_ALIGN_TOP_LEFT, 160, 0);
// text column