Files
MeowOS-SDK/ui/full.c
T

58 lines
1.9 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/full.c — 全屏页(ACT_FULL)view + 控制器。
*
* 无控件:进入时声明全屏+状态栏收合,绘制 accent 底 + 三行文本;点任意处/左缘左滑回 home。
* 页面切换由 meow_view_page_push/pop 驱动 on_enter/on_leave(activity_push/pop 在 page_push/pop 内)。
* 注:on_leave 里 activity_active() 仍为 ACT_FULL(activity_pop 在其后),故 OFF 日志的 activity
* id 与旧 set_fullscreen(0) 略异——纯诊断日志差异,功能无变化(见报告)。
*/
#include "hello_internal.h"
static full_ctrl g_full_ctrl;
static int g_full = 0; /* 1=处于全屏视图 */
void full_draw(void)
{
const meow_theme *th = meow_theme_get();
meow_ui_clear(th->accent);
meow_ui_text_center(240, 330, "FULLSCREEN ACTIVE", 28, 0xFFFFFF);
meow_ui_text_center(240, 366, "tap anywhere = back to home", 20, 0xFFFFFF);
meow_ui_text_center(240, 394, "(left-edge swipe also returns)", 20, 0xFFFFFF);
meow_ui_flush();
}
static void full_page_enter(meow_view *v, void *ctx)
{
(void)v;
((full_ctrl *)ctx)->active = 1;
g_full = 1;
meow_ui_set_fullscreen(1);
meow_ui_statusbar_set_collapsed(1);
hello_nav_report(); /* ① 上报 full 栈深/顶层 */
full_draw();
meow_log(MEOW_LOG_INFO, "fullscreen ON (collapsed), activity->%d", meow_ui_activity_active());
}
static void full_page_leave(meow_view *v, void *ctx)
{
(void)v;
((full_ctrl *)ctx)->active = 0;
g_full = 0;
meow_ui_set_fullscreen(0);
meow_ui_statusbar_set_collapsed(0);
meow_log(MEOW_LOG_INFO, "fullscreen OFF (restore), activity->%d", meow_ui_activity_active());
}
int full_is_active(void)
{
return g_full;
}
meow_view *full_view_create(void)
{
static const meow_view_hooks h = {
.on_enter = full_page_enter,
.on_leave = full_page_leave,
};
return meow_view_create(ACT_FULL, MEOW_VIEW_ACTIVITY, &h, &g_full_ctrl);
}