Files
MeowOS-SDK/tuku/ui/settings/settings.c
T
AskaEth f4c21c74a1 fix(tuku): 书库显式启用 MD3 容器模式并补 M4/M5 接缝注释
- 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 零警告
2026-11-04 20:09:24 +08:00

62 lines
2.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* ui/settings/settings.c — 设置页(ACT_SETTINGS)M3 骨架。
*
* M5 在此实现 APP 启动 PIN 等设置项;本批只落可编译桩,入口为书库 TopAppBar ⚙。
* 返回:左缘返回(app.c SWIPE_LEFT → page_pop)。
*
* 接缝注意(M5):meow_view 的 on_create 在 meow_view_create 内运行(activity 栈空);
* 本页是非根页,控件必须 lazy 到 on_enter 建,或照 hello demo_init 的模式
* meow_ui_activity_push(ACT_SETTINGS) → 建控件 → meow_ui_activity_pop()
* (examples/hello/ui/demo/demo.c:515-522);否则 owner 绑到 ACT_LIBRARY,设置控件会从
* 书库页被命中(§6.1 跨页泄漏)。
*/
#include "tuku_internal.h"
static mr_page_ctrl g_ctrl;
static void settings_draw(meow_view *v, const meow_theme *th, void *ctx)
{
(void)v; (void)ctx;
int w = meow_ui_width();
int sb = meow_ui_statusbar_height();
meow_ui_fill_rect(0, sb, w, 56, th->surfaceContainer);
meow_ui_text(w / 2, sb + 16, "Settings", th->font_title, th->onSurface);
meow_ui_text_center(w / 2, sb + 100, "APP options", th->font_body, th->onSurfaceVariant);
meow_ui_text_center(w / 2, sb + 140, "Startup PIN — M5", th->font_body, th->onSurface);
meow_ui_text_center(w / 2, sb + 180, "Reader direction — M4", th->font_body,
th->onSurface);
meow_ui_text_center(w / 2, sb + 240, "Theme follows the system automatically",
th->font_body, th->onSurfaceVariant);
meow_ui_text_center(w / 2, sb + 300, "left-edge swipe = back", th->font_body,
th->onSurfaceVariant);
}
static void settings_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 settings_page_leave(meow_view *v, void *ctx)
{
(void)v;
((mr_page_ctrl *)ctx)->active = 0;
}
meow_view *settings_view_create(void)
{
static const meow_view_hooks h = {
.on_enter = settings_page_enter,
.on_leave = settings_page_leave,
.on_draw = settings_draw,
};
return meow_view_create(ACT_SETTINGS, MEOW_VIEW_ACTIVITY, &h, &g_ctrl);
}