style(launcher): 主界面顶栏'后台'按钮图标美化 — 去方形primary底改surface_container柔和圆角+矢量双卡层叠图标(后台应用堆叠语义)+小字'后台';命中矩形/入口不变,0warning

This commit is contained in:
AskaEth committed 2026-09-04 03:51:30 +08:00
1 parent b23c6d53c4
commit 491db5069c
1 file changed
+23 -6
+23 -6
View File
@@ -96,18 +96,24 @@ static void menu_after_app_exit(int app_ran)
static int menu_title_size(void); /* 前向声明:draw_header_content 用(定义在下方布局帮助块) */
static uint32_t menu_contrast(uint32_t c); /* 前向声明(定义在下方布局帮助块) */
/* 批③:桌面顶栏居右「后台管理」按钮(图标 tile + 字块)。命中区见 BGMR_BTN_*。 */
/* 批③:桌面顶栏居右「后台管理」按钮(柔和圆角底 + 层叠卡片图标 + 小字,替下原先整块
* primary 方块)。命中区见 BGMR_BTN_*(不变)。 */
#define BGMR_BTN_S 46 /* 按钮边长 */
#define BGMR_BTN_X0 (fb_xres - BGMR_BTN_S - 14) /* 右缘留 14px 边距 */
#define BGMR_BTN_Y0 40 /* 顶缘(标题行内,apps 区之上) */
static void menu_draw_bgm_btn(const meow_ui_theme_t *th)
{
int x = BGMR_BTN_X0, y = BGMR_BTN_Y0, s = BGMR_BTN_S;
fill_rect(x, y, s, s, th->primary);
/* 柔和圆角底(surface_container 卡片语义),与主界面卡片/容器视觉统一 */
meow_gfx_fill_round(x, y, s, s, 12, th->surface_container);
/* 层叠卡片图标 = 后台/应用栈:后卡 muted、前卡 primary(前卡后画盖住后卡中部) */
int cx = x + s / 2;
meow_gfx_fill_round(cx - 13, y + 13, 18, 12, 4, th->on_surface_variant); /* 后卡 */
meow_gfx_fill_round(cx - 5, y + 6, 18, 12, 4, th->primary); /* 前卡 */
/* 小字标签(on_surface,落在 surface_container 底上对比足够) */
const char *lab = meow_str_zh("bgmgr.topbtn", "后台");
int tw = meow_ui_text_width(lab, 14);
ui_draw(x + (s - tw) / 2, y + (s - meow_font_line_height(14)) / 2, lab,
menu_contrast(th->primary), 14);
ui_draw(cx - tw / 2, y + 27, lab, th->on_surface, 14);
}
static int menu_hit_bgm_btn(int tx, int ty)
{
@@ -187,6 +193,13 @@ void s_draw_chevron_left(int x, int y, uint32_t color)
#define MENU_LIST_ROW_H 60 /* 列表行高(大图标行) */
#define MENU_LIST_ICON 40 /* 列表图标 ink 高(方) */
#define MENU_LIST_ICON_X 24 /* 列表图标左缘 */
/* 圆角卡列表项外边距(item margin/gap):相邻卡片间可见空隙 px。SDK listview 行距(=MENU_LIST_ROW_H)
* 不变——卡片在其行高内上下对称内缩 MENU_LIST_ROW_GAP/2,故内容(按行高垂直居中)仍落卡中心;
* 相邻卡顶间距恒=MENU_LIST_ROW_H=卡高+MENU_LIST_ROW_GAP。要求偶数,保证上下对称。 */
#define MENU_LIST_ROW_GAP 8
/* 第 idx 行(行顶 row_top,行高 h)的圆角卡:顶 y 与高。卡片上下对称内缩,行中心=卡中心。 */
static inline int menu_row_card_y(int row_top) { return row_top + MENU_LIST_ROW_GAP / 2; }
static inline int menu_row_card_h(int h) { return h - MENU_LIST_ROW_GAP; }
/* 应用图标缓存(进主界面加载一次,不每帧解码;index 对齐 apps[]) */
static meow_img *s_app_icons[MAX_APPS];
@@ -619,10 +632,14 @@ static void menu_draw_list_cell(const struct app *a, meow_img *icon, int x, int
int w, int h, int sel, int pressed,
const meow_ui_theme_t *th)
{
meow_gfx_fill_round(x, y, w, h, 12, th->surface_container);
/* 圆角卡在行高内上下对称内缩(card center = 行中心):给相邻圆角卡之间留出可见外距,
* 消除原来「卡高==行距」导致的紧贴。内容仍按整行高垂直居中(行中心=卡中心)。 */
int cy = menu_row_card_y(y);
int ch = menu_row_card_h(h);
meow_gfx_fill_round(x, cy, w, ch, 12, th->surface_container);
if (sel || pressed) {
int alpha = pressed ? 72 : 40;
meow_gfx_fill_round_alpha(x, y, w, h, 12, th->primary, alpha);
meow_gfx_fill_round_alpha(x, cy, w, ch, 12, th->primary, alpha);
}
int sz = MENU_LIST_ICON;
int icy = y + (h - sz) / 2;