- meow_ui.h(922 行)改为伞头:只做 #include 聚合 + 模块索引,不定义新 API。 - 新增 patch_v2/sdk/include/ 16 个子头(types/draw/image/theme/ime/widgets/input/ activity/zorder/statusbar/dialog/log/notify/config/font/audio),各自自洽可单独 include, 依赖最小化(不透明句柄前向声明 + 必要模块互引)。 - 验证:meow_ui.a md5 与主树完全一致(4786158d…,头重组 .o 逐字节等价); SDK .c 用 mipsel -Wall -Wextra 0 warning;hello/files 全量重编链接通过 (-Wall -Wextra 0 warning);宿主 test_p1p2p3_repro(P1c/P2/P3 ALL PASS) + 15 个 SDK/宿主测试 PASS;16 子头自洽编译 0 warning;伞头完整性回归 test_umbrella.c 0 warning;ncm 5 个含 meow_ui.h TÜ mipsel 交叉编译到 .o 0 warning。 - meow_ui_internal.h 及 view/nav/media/sys/vol 子头未动;build_sdk.sh 无需改。 - MEOW_APP_SDK.md 头部新增「公共头模块索引」。分支 sdk-header-split。
80 lines
4.1 KiB
C
80 lines
4.1 KiB
C
/*
|
||
* meow_ui_theme.h — SDK 主题/配置(§8):主题模型 + MD3 语义色板 + 顶级主题风格族。
|
||
*
|
||
* 原 meow_ui.h 拆分的一部分(theme 模块)。权威结构体名 = meow_theme(App 侧),
|
||
* 与 launcher 内部的 meow_ui_theme_t(font_theme.c,仅供状态栏/设置页)无关。
|
||
*/
|
||
#ifndef MEOW_UI_THEME_H
|
||
#define MEOW_UI_THEME_H
|
||
|
||
#include "meow_ui_types.h"
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* ============================================================ */
|
||
/* §8 主题/配置 */
|
||
/* ============================================================ */
|
||
typedef enum { MEOW_THEME_LIGHT, MEOW_THEME_DARK, MEOW_THEME_AUTO } meow_theme_mode;
|
||
|
||
/* 主题(§5.8.4 + §8.1.3)。既有字段 bg/fg/accent/dim 保留(兼容映射,见下表),
|
||
* 其后追加 MD3 语义色板 + 风格参数段(扩展兼容——既有代码读旧字段不受影响)。
|
||
* 映射:bg↔surface、fg↔onSurface、accent↔primary、dim↔onSurfaceVariant。
|
||
* 「当前 style×mode」完整主题 = meow_theme_get()(MD3 默认;MIUIx 用 MD3 基础/占位)。 */
|
||
typedef struct meow_theme {
|
||
/* —— 既有字段(兼容保留;映射见上)—— */
|
||
uint32_t bg; /* 背景色 = surface */
|
||
uint32_t fg; /* 前景/正文 = onSurface */
|
||
uint32_t accent; /* 强调色(按钮/选中)= primary */
|
||
uint32_t dim; /* 次要文字 = onSurfaceVariant */
|
||
int font_title; /* 28 */
|
||
int font_body; /* 20 */
|
||
|
||
/* —— MD3 语义色板(§5.8.4;日/夜各一组,AUTO 按 meow_theme_mode 切换)—— */
|
||
uint32_t primary, onPrimary, primaryContainer, onPrimaryContainer;
|
||
uint32_t secondary, onSecondary, secondaryContainer, onSecondaryContainer;
|
||
uint32_t tertiary, onTertiary, tertiaryContainer, onTertiaryContainer;
|
||
uint32_t surface, onSurface, surfaceVariant, onSurfaceVariant;
|
||
uint32_t surfaceContainerLowest, surfaceContainerLow, surfaceContainer,
|
||
surfaceContainerHigh, surfaceContainerHighest;
|
||
uint32_t surfaceDim, surfaceBright, surfaceTint;
|
||
uint32_t outline, outlineVariant, scrim;
|
||
uint32_t error, onError, errorContainer, onErrorContainer;
|
||
uint32_t inverseSurface, inverseOnSurface, inversePrimary;
|
||
uint32_t shadow; /* 仅状态层/描边近似用;无 GPU 不做投影(§5.8.7) */
|
||
|
||
/* —— 风格参数段(§8.1.3;MD3 默认 / MIUIx 加大圆角+描边+间距)—— */
|
||
int radius; /* 控件默认圆角(按钮等,px) */
|
||
int radius_card; /* 卡片/容器默认圆角(px) */
|
||
int spacing; /* 布局/间距步进(px) */
|
||
int stroke_w; /* 默认细描边宽(0=无边框,MD3;MIUIx=1) */
|
||
} meow_theme;
|
||
|
||
const meow_theme *meow_theme_get(void);
|
||
void meow_theme_set_mode(meow_theme_mode m);
|
||
meow_theme_mode meow_theme_get_mode(void);
|
||
|
||
typedef void (*meow_theme_listener)(meow_theme_mode m);
|
||
void meow_theme_add_listener(meow_theme_listener cb);
|
||
void meow_theme_remove_listener(meow_theme_listener cb);
|
||
|
||
/* [D4] 脱机访问两套内置色板(无 settings 文件也可靠):返回当前解析生效的色板副本。 */
|
||
meow_theme meow_theme_defaults(meow_theme_mode m);
|
||
|
||
/* ---- §8.1 顶级主题风格族(minimal,2026-08-30)----
|
||
* 主题 = 顶级主题风格族(ui.style:MD3/MIUIx)× 明暗(display.theme)。本批只落「状态栏图标集
|
||
* 随 ui.style 换集」的最小闭环:meow_ui_set_style 记录 style(同值忽略)+ 触发 theme_reload/
|
||
* 广播(让状态栏/控件下一帧用新 style 重绘)。style 还决定状态栏右侧图标集(§3.1 同一个状态栏)。
|
||
* 完整 style×mode 配色/控件形态矩阵(§8.1.3)为后续里程碑。 */
|
||
#define MEOW_STYLE_MD3 0 /* Material You(默认) */
|
||
#define MEOW_STYLE_MIUIX 1 /* MIUI 风格族(基础占位) */
|
||
|
||
void meow_ui_set_style(int style); /* 设顶级主题风格族;越界 clamp 到合法值;同值忽略 */
|
||
int meow_ui_style(void); /* 当前 style(默认 MEOW_STYLE_MD3) */
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
#endif /* MEOW_UI_THEME_H */
|