From f3ee043b5a6606c2cc8e69fbbe64254b6044df40 Mon Sep 17 00:00:00 2001 From: "Michael A. Cojocari" Date: Fri, 25 Sep 2026 20:57:49 -0400 Subject: [PATCH] fix(tdisplay-p4): contact action sheet is one column in portrait The sheet's two-column grid of half-width buttons cut most labels off with "..." on the narrow portrait panel. In portrait every action gets its own full-width row; the card grows to fit and its body scrolls past the screen height like any tall sheet. Delete stays the red bottom row. Landscape and the other boards keep the grid. Co-Authored-By: Claude Opus 5.5 --- src/ui-touch/UITask.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ui-touch/UITask.cpp b/src/ui-touch/UITask.cpp index 5096bfb..e23aee4 100644 --- a/src/ui-touch/UITask.cpp +++ b/src/ui-touch/UITask.cpp @@ -20600,7 +20600,16 @@ static void openContactActionSheet(uint32_t mesh_idx, bool is_repeater, const ch // rooms (1), + line-of-sight (1), + Show on map (1 when contact has GPS and // !from_map). const int grid_items = (from_map ? 5 : 7) + (is_repeater ? 2 : 0) + (is_room ? 1 : 0) + (has_los ? 1 : 0) + (has_map_btn ? 1 : 0); - const int grid_rows = (grid_items + 1) / 2; // ceil + // P4 portrait: the 2-column grid cut most labels off with "..." on the narrow + // panel, so every action gets its own full-width row. The card grows to fit and + // the body scrolls past the screen height like any tall sheet. Landscape and the + // other boards keep the grid. +#if CAP_ROUND_CORNERS + const bool one_col = lv_disp_get_hor_res(nullptr) <= lv_disp_get_ver_res(nullptr); +#else + const bool one_col = false; +#endif + const int grid_rows = one_col ? grid_items : (grid_items + 1) / 2; // ceil const int body_content_h = (grid_rows + 1) * btn_h + grid_rows * btn_gap; int card_h = 2 * padding + title_h + body_content_h; // Cap the card to the visible area and let the BUTTON BODY (below the fixed title/X) scroll when it @@ -20655,9 +20664,9 @@ static void openContactActionSheet(uint32_t mesh_idx, bool is_repeater, const ch #else const int col_gap = 6; #endif - const int half_w = (card_w - 2 * padding - col_gap) / 2; + const int half_w = one_col ? (card_w - 2 * padding) : (card_w - 2 * padding - col_gap) / 2; int y = 0; - int col = 0; // 0 = left column, 1 = right column + int col = 0; // 0 = left column, 1 = right column (always 0 when one_col) // Tanmatsu rows grow with the panel; the Pager uses fixed-size chrome so text // presets do not overfill compact rows. Other boards retain g_font_12. #if defined(TLORA_PAGER) @@ -20685,7 +20694,8 @@ static void openContactActionSheet(uint32_t mesh_idx, bool is_repeater, const ch lv_obj_set_size(l, half_w - 8, lv_font_get_line_height(row_font)); lv_obj_set_style_text_align(l, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN); lv_obj_center(l); - if (col == 0) col = 1; + if (one_col) y += btn_h + btn_gap; + else if (col == 0) col = 1; else { col = 0; y += btn_h + btn_gap; } }; // Full-width row (Delete). Closes any half-open grid row first.