- P1:list_rebuild() 在 set_item_renderer/set_item_tier 后调用 meow_listview_set_container(g_lv,1), 修正 SDK 默认 container=0(扁平满幅+分隔线)与任务要求的 MD3 圆角卡观感不一致 - P2:reader/lock/settings 桩头补接缝注释——on_create 在 meow_view_create 内运行且 activity 栈空, 非根页控件须 lazy 到 on_enter 或 push→建→pop;lock 另注明必须由自身 view on_event 消费 SWIPE, 否则左缘滑动绕过 PIN - 复验:宿主测试 46/46 PASS;交叉构建静态 MIPS32r2 ELF、-Wall -Wextra 零警告
66 lines
2.3 KiB
C
66 lines
2.3 KiB
C
/* ui/lock/lock.c — 锁屏页(ACT_LOCK)M3 桩 + M5 接缝。
|
||
*
|
||
* M5 在此实现「APP 启动 PIN」:lock_view_should_show() 读配置决定是否锁,
|
||
* 锁屏页负责 PIN 输入/校验后 page_pop 回书库。本批桩恒返回 0(不锁),页面仅可编译占位。
|
||
*
|
||
* 接缝注意(M5):
|
||
* ① meow_view 的 on_create 在 meow_view_create 内运行(此时 activity 栈空);本页是非根页,
|
||
* 控件必须 lazy 到 on_enter 建,或照 hello demo_init 的模式
|
||
* meow_ui_activity_push(ACT_LOCK) → 建控件 → meow_ui_activity_pop()
|
||
* (examples/hello/ui/demo/demo.c:515-522);否则 owner 绑到 ACT_LIBRARY,
|
||
* 锁屏控件会从书库页被命中(§6.1 跨页泄漏)。
|
||
* ② 锁屏必须经自身 view 的 on_event 消费 SWIPE:meow_view_dispatch_event 先于 App 的
|
||
* on_swipe(sdk/meow_ui_view.h:83-88);否则 app.c 对非 library 页的左缘滑动无条件
|
||
* page_pop,PIN 会被绕过。
|
||
*/
|
||
#include "tuku_internal.h"
|
||
|
||
static mr_page_ctrl g_ctrl;
|
||
|
||
int lock_view_should_show(void)
|
||
{
|
||
return 0; /* M5:读 APP 启动 PIN 配置后返回 1 */
|
||
}
|
||
|
||
static void lock_draw(meow_view *v, const meow_theme *th, void *ctx)
|
||
{
|
||
(void)v; (void)ctx;
|
||
int w = meow_ui_width();
|
||
int h = meow_ui_height();
|
||
int cy = h / 2;
|
||
|
||
meow_ui_text_center(w / 2, cy - 80, "LOCKED", th->font_title, th->primary);
|
||
meow_ui_text_center(w / 2, cy - 36, "Startup PIN (M5)", th->font_body, th->onSurface);
|
||
meow_ui_text_center(w / 2, cy + 8, "PIN entry will be implemented in M5",
|
||
th->font_body, th->onSurfaceVariant);
|
||
}
|
||
|
||
static void lock_page_enter(meow_view *v, void *ctx)
|
||
{
|
||
((mr_page_ctrl *)ctx)->active = 1;
|
||
v->x = 0;
|
||
v->y = 0;
|
||
v->w = meow_ui_width();
|
||
v->h = meow_ui_height();
|
||
meow_ui_set_fullscreen(0);
|
||
meow_ui_set_page_bg(meow_theme_get()->bg);
|
||
mr_nav_report();
|
||
meow_ui_paint_full();
|
||
}
|
||
|
||
static void lock_page_leave(meow_view *v, void *ctx)
|
||
{
|
||
(void)v;
|
||
((mr_page_ctrl *)ctx)->active = 0;
|
||
}
|
||
|
||
meow_view *lock_view_create(void)
|
||
{
|
||
static const meow_view_hooks h = {
|
||
.on_enter = lock_page_enter,
|
||
.on_leave = lock_page_leave,
|
||
.on_draw = lock_draw,
|
||
};
|
||
return meow_view_create(ACT_LOCK, MEOW_VIEW_ACTIVITY, &h, &g_ctrl);
|
||
}
|