feat(sdk): M6.39批 — LazyGrid/LazyColumn/LazyRow MD3容器化 + SDK全局App内底部上滑回桌面(系统手势优先)

- meow_ui_widget.c: W_LIST/meow_list/LazyColumn/LazyRow默认container=1(MD3圆角卡surfaceContainer+tonal选中+卡内按压+去分隔线) + 新增meow_list_set_container; 平坦回退set_container(0)
- meow_lazygrid.c: lg_draw_cell容器化(卡内缩8,surfaceContainer圆角+tonal选中+按压)
- meow_ui_input.c: 新增meow_ui_input_is_home_swipe(镜像np_home_gesture:屏底28px热区+上移65px+竖向主导,与左缘返回/列表中滑互斥) + MEOW_EV_HOME分发→meow_ui_nav_request_exit(系统保留手势**优先于App on_swipe**,任意App内生效→MSG_NAV EXIT→批①保活回桌面; 不调request_exit避免进程退出断送保活)
- 声明: meow_ui_input.h / meow_ui_widgets.h 各追加
- 宿主测试: test_meow_ui_home_gesture 19-0 / test_meow_ui_lazygrid 32-0, 0warning
This commit is contained in:
AskaEth committed 2026-09-04 13:56:11 +08:00
1 parent d0a5901ffb
commit 501867b362
7 files changed
+350 -32

No files matched your search

+24 -13
View File
@@ -268,35 +268,46 @@ int meow_lazygrid_hit(meow_lazygrid *g, int x, int y)
}
/* ---- 绘制(只画可见行;clip 钳到宫格视口)---- */
/* MD3 容器(默认 renderer P0):格=格内对称内缩 surfaceContainer 圆角卡(radius_card)+ 卡内 tonal
* 选中(primaryContainer)/ 按压(primary α26);画布=整格(触控目标),卡在其内对称内缩(同
* meow_listview 行>卡范式:卡片外仍命中整格,视觉卡留出呼吸空隙)。完全自绘(set_item_draw)
* 覆盖本 renderer,App 自理容器观感。 */
#define MEOW_LAZYGRID_CARD_MARGIN 8 /* 格内对称边距(卡内缩;与 cell gap 叠加出卡间空隙) */
static void lg_draw_cell(meow_lazygrid *g, const meow_theme *th, int index,
int cell_x, int cell_y, meow_lazygrid_item *it)
{
int sel = (index == g->sel);
int txtcol = sel ? th->onPrimaryContainer : th->onSurface;
int subcol = sel ? th->onPrimaryContainer : th->onSurfaceVariant;
uint32_t bg = sel ? th->primaryContainer : th->surfaceContainerLow;
meow_gfx_fill_round(cell_x, cell_y, g->cell_w, g->cell_h, th->radius_card, bg);
int m = MEOW_LAZYGRID_CARD_MARGIN;
int cw = g->cell_w - 2 * m, chh = g->cell_h - 2 * m; /* 卡尺寸(格内对称内缩) */
int cx = cell_x + m, cy = cell_y + m; /* 卡左上 */
int press = meow_input_touch_down() &&
meow_input_touch_x() >= cell_x && meow_input_touch_x() < cell_x + g->cell_w &&
meow_input_touch_y() >= cell_y && meow_input_touch_y() < cell_y + g->cell_h;
meow_gfx_fill_round(cx, cy, cw, chh, th->radius_card, th->surfaceContainer);
if (sel) meow_gfx_fill_round(cx, cy, cw, chh, th->radius_card, th->primaryContainer);
else if (press) meow_gfx_fill_round_alpha(cx, cy, cw, chh, th->radius_card, th->primary, 26);
int pad = 8;
int thh = meow_ui_text_height(th->font_body);
int chh = g->cell_h, cw = g->cell_w;
/* 图标(可选):居中于格顶 ~50%。 */
/* 图标(可选):居中于卡顶 ~50%(卡中心=格中心,因对称内缩)。 */
if (it->icon) {
int isz = cw * 6 / 10; if (isz > chh * 5 / 10) isz = chh * 5 / 10;
int isz = g->cell_w * 6 / 10; if (isz > g->cell_h * 5 / 10) isz = g->cell_h * 5 / 10;
if (isz < 16) isz = 16;
int icx = cell_x + cw / 2, icy = cell_y + pad + isz / 2;
int icx = cx + cw / 2, icy = cy + pad + isz / 2;
meow_ui_img_scaled(icx - isz / 2, icy - isz / 2, isz, isz, (meow_img *)it->icon);
}
/* 标题 + 副标题(主界面:名 + 状态)。底部对齐。 */
/* 标题 + 副标题(主界面:名 + 状态)。卡内底部对齐。 */
int has_sub = (it->subtitle && it->subtitle[0]);
int ty = cell_y + chh - pad - thh - (has_sub ? (thh + 2) : 0);
if (it->title) meow_ui_text_center(cell_x + cw / 2, ty, it->title, th->font_body, txtcol);
if (has_sub) meow_ui_text_center(cell_x + cw / 2, ty + thh + 2, it->subtitle, th->font_body, subcol);
int ty = cy + chh - pad - thh - (has_sub ? (thh + 2) : 0);
if (it->title) meow_ui_text_center(cx + cw / 2, ty, it->title, th->font_body, txtcol);
if (has_sub) meow_ui_text_center(cx + cw / 2, ty + thh + 2, it->subtitle, th->font_body, subcol);
/* 选中描边(轮廓);禁用整体变淡。 */
if (sel) meow_ui_draw_rect_round(cell_x, cell_y, cw, chh, th->radius_card, th->primary);
/* 选中描边(轮廓);禁用卡内变淡(圆角 α,防圆角外叠出灰方块)。 */
if (sel) meow_ui_draw_rect_round(cx, cy, cw, chh, th->radius_card, th->primary);
if (!it->enabled)
meow_ui_fill_rect_alpha(cell_x, cell_y, cw, chh, th->onSurface, 90);
meow_gfx_fill_round_alpha(cx, cy, cw, chh, th->radius_card, th->onSurface, 90);
}
void meow_lazygrid_draw(meow_lazygrid *g, const meow_theme *th)