diff --git a/src/ui/weather_detail_screen.cpp b/src/ui/weather_detail_screen.cpp index a2aaaa8..4b7c255 100644 --- a/src/ui/weather_detail_screen.cpp +++ b/src/ui/weather_detail_screen.cpp @@ -30,68 +30,53 @@ void buildList() { return; } - // Header row with column titles. - lv_obj_t *header = lv_label_create(list); - lv_label_set_text(header, "Icon Uhrzeit Grad Text Regen %"); - lv_obj_set_style_text_font(header, &lv_font_montserrat_14, 0); - lv_obj_set_style_text_color(header, Theme::text(), 0); - - // Separator line below header. - lv_obj_t *header_line = lv_line_create(list); - static lv_point_precise_t header_points[] = {{0, 0}, {280, 0}}; - lv_line_set_points(header_line, header_points, 2); - lv_obj_set_style_line_color(header_line, Theme::textDim(), 0); - lv_obj_set_style_line_width(header_line, 1, 0); - for (const auto &fe : w.forecast) { lv_obj_t *row = lv_obj_create(list); - lv_obj_set_size(row, 280, 30); + 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, 4, 0); + lv_obj_set_style_border_width(row, 1, 0); + lv_obj_set_style_border_side(row, LV_BORDER_SIDE_BOTTOM, 0); + lv_obj_set_style_border_color(row, lv_color_hex(0x555555), 0); + lv_obj_set_style_pad_all(row, 8, 0); + lv_obj_set_style_pad_bottom(row, 12, 0); lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE); - // time hh:mm int tIdx = fe.time.indexOf('T'); String hhmm = tIdx > 0 ? fe.time.substring(tIdx + 1, tIdx + 6) : fe.time; - // icon - use weather symbol + // Zeile 1: Icon + Uhrzeit + Grad + Regen% lv_obj_t *icon = Icons::createWeatherIcon(row, fe.symbol, fe.description, 24); - lv_obj_align(icon, LV_ALIGN_TOP_LEFT, 10, 0); + lv_obj_align(icon, LV_ALIGN_TOP_LEFT, 0, 0); - // 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, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(time_label, LV_ALIGN_TOP_LEFT, 44, 0); + lv_obj_set_style_text_color(time_label, Theme::text(), 0); + lv_obj_set_style_text_font(time_label, &lv_font_montserrat_24, 0); + lv_obj_align_to(time_label, icon, LV_ALIGN_OUT_RIGHT_MID, 8, 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, lv_color_hex(0xFFFFFF), 0); - lv_obj_align(temp_label, LV_ALIGN_TOP_LEFT, 160, 0); + lv_label_set_text(temp_label, (String(fe.temperature) + "°").c_str()); + lv_obj_set_style_text_color(temp_label, Theme::text(), 0); + lv_obj_set_style_text_font(temp_label, &lv_font_montserrat_24, 0); + lv_obj_align_to(temp_label, time_label, LV_ALIGN_OUT_RIGHT_MID, 8, 0); - // text column - String desc = sanitizeGermanText(fe.description.substring(0, 20)); - if (fe.precipitationType == "rain" && fe.precipitationProbability > 0.0f) { - char buf[8]; - snprintf(buf, sizeof(buf), " %.0f%%", fe.precipitationProbability * 100); - desc += buf; - } - lv_obj_t *desc_label = lv_label_create(row); - lv_label_set_text(desc_label, desc.c_str()); - lv_obj_set_style_text_color(desc_label, fe.precipitationType == "rain" ? Theme::accentRain() : Theme::textDim(), 0); - lv_obj_align(desc_label, LV_ALIGN_TOP_LEFT, 220, 0); - - // rain probability column - show percentage for rain if (fe.precipitationType == "rain" && fe.precipitationProbability > 0.0f) { char buf[8]; snprintf(buf, sizeof(buf), "%.0f%%", fe.precipitationProbability * 100); lv_obj_t *rain_label = lv_label_create(row); lv_label_set_text(rain_label, buf); lv_obj_set_style_text_color(rain_label, Theme::accentRain(), 0); - lv_obj_align(rain_label, LV_ALIGN_TOP_LEFT, 260, 0); + lv_obj_set_style_text_font(rain_label, &lv_font_montserrat_24, 0); + lv_obj_align_to(rain_label, temp_label, LV_ALIGN_OUT_RIGHT_MID, 8, 0); } + + // Zeile 2: Beschreibung (kleiner) + String desc = sanitizeGermanText(fe.description.substring(0, 25)); + lv_obj_t *desc_label = lv_label_create(row); + lv_label_set_text(desc_label, desc.c_str()); + lv_obj_set_style_text_color(desc_label, fe.precipitationType == "rain" ? Theme::accentRain() : Theme::textDim(), 0); + lv_obj_set_style_text_font(desc_label, &lv_font_montserrat_20, 0); + lv_obj_align(desc_label, LV_ALIGN_TOP_LEFT, 0, 28); } } @@ -100,11 +85,15 @@ void buildList() { void weatherDetailScreen_setNavigator(ScreenId (*nav)(ScreenId)) { g_navigate = nav; } void weatherDetailScreen_create(Screen &s) { - list = lv_list_create(s.root); + list = lv_obj_create(s.root); 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_flex_flow(list, LV_FLEX_FLOW_COLUMN); + lv_obj_set_style_pad_row(list, 0, 0); + lv_obj_add_flag(list, LV_OBJ_FLAG_SCROLLABLE); back_button_create(s.root, on_back, nullptr); }