adjust mvg UI

This commit is contained in:
2026-08-02 14:34:09 +02:00
parent 7a99a84155
commit 4f596a8f85
2 changed files with 13 additions and 3 deletions
+2
View File
@@ -31,6 +31,8 @@ inline lv_color_t accentSun() { return lv_color_hex(0xFBC02D); }
inline lv_color_t accentRain() { return lv_color_hex(0x4FC3F7); } inline lv_color_t accentRain() { return lv_color_hex(0x4FC3F7); }
inline lv_color_t accentUBahn() { return lv_color_hex(0x0079F6); } // MVG U-Bahn blue inline lv_color_t accentUBahn() { return lv_color_hex(0x0079F6); } // MVG U-Bahn blue
inline lv_color_t accentSBahn() { return lv_color_hex(0x0CB87E); } // MVG S-Bahn green inline lv_color_t accentSBahn() { return lv_color_hex(0x0CB87E); } // MVG S-Bahn green
inline lv_color_t accentBus() { return lv_color_hex(0xF57C00); } // MVG Bus orange
inline lv_color_t accentTram() { return lv_color_hex(0xE040FB); } // MVG Tram magenta
inline lv_color_t accentWarn() { return lv_color_hex(0xFFB300); } inline lv_color_t accentWarn() { return lv_color_hex(0xFFB300); }
inline lv_color_t accentError() { return lv_color_hex(0xF44336); } inline lv_color_t accentError() { return lv_color_hex(0xF44336); }
inline lv_color_t accentStorm() { return lv_color_hex(0xFFD54F); } inline lv_color_t accentStorm() { return lv_color_hex(0xFFD54F); }
+11 -3
View File
@@ -16,6 +16,14 @@ lv_obj_t *list = nullptr;
unsigned long lastFetchMs = 0; unsigned long lastFetchMs = 0;
const unsigned long REFRESH_INTERVAL_MS = 60UL * 1000UL; const unsigned long REFRESH_INTERVAL_MS = 60UL * 1000UL;
lv_color_t typeColor(const String &type) {
if (type == "UBAHN") return Theme::accentUBahn();
if (type == "SBAHN") return Theme::accentSBahn();
if (type == "BUS") return Theme::accentBus();
if (type == "TRAM") return Theme::accentTram();
return Theme::textDim();
}
void buildList() { void buildList() {
if (!list) return; if (!list) return;
lv_obj_clean(list); lv_obj_clean(list);
@@ -34,13 +42,12 @@ void buildList() {
lv_obj_set_style_border_width(row, 0, 0); lv_obj_set_style_border_width(row, 0, 0);
lv_obj_set_style_pad_all(row, 6, 0); lv_obj_set_style_pad_all(row, 6, 0);
lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE); lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_style_text_color(row, Theme::text(), 0);
// Line badge (colored text: U red, S green).
String badge = String(dep.icon) + " " + dep.line; String badge = String(dep.icon) + " " + dep.line;
lv_obj_t *ln = lv_label_create(row); lv_obj_t *ln = lv_label_create(row);
lv_label_set_text(ln, badge.c_str()); lv_label_set_text(ln, badge.c_str());
lv_obj_set_style_text_color(ln, lv_obj_set_style_text_color(ln, typeColor(dep.type), 0);
dep.type == "UBAHN" ? Theme::accentUBahn() : Theme::accentSBahn(), 0);
lv_obj_align(ln, LV_ALIGN_TOP_LEFT, 0, 0); lv_obj_align(ln, LV_ALIGN_TOP_LEFT, 0, 0);
String dest = sanitizeGermanText(dep.destination.substring(0, 20)); String dest = sanitizeGermanText(dep.destination.substring(0, 20));
@@ -81,6 +88,7 @@ void mvgScreen_create(Screen &s) {
lv_obj_set_size(list, 320, 480 - 80); lv_obj_set_size(list, 320, 480 - 80);
lv_obj_set_style_bg_color(list, Theme::bg(), 0); lv_obj_set_style_bg_color(list, Theme::bg(), 0);
lv_obj_set_style_border_width(list, 0, 0); lv_obj_set_style_border_width(list, 0, 0);
lv_obj_set_style_text_color(list, Theme::text(), 0);
back_button_create(s.root, on_back, nullptr); back_button_create(s.root, on_back, nullptr);
} }