fix(lyric): 全局播放页进度条/按钮带局部重绘回退默认色修复 — 取色主题抽共用(np_grad_row/np_page_bg_row/np_theme_widgets),1s局部重绘也接取色(带底色渐变/进度条fill=accent/track=fg_dim/四钮accent);SDK W_PROGRESS改读opts.bg/fg向后兼容;宿主R1-R3 PASS,0warning;需重编meow_ui.a+四App重链
This commit is contained in:
1 parent
8971f6067b
commit
a82f3f9dfa
5 files changed
+180
-30
No files matched your search
@@ -49,6 +49,7 @@ int meow_btn_pressed(meow_widget *w); /* 应用在 on_tap 命中后
|
||||
/* ---- §5.8.2 Modifier 式通用 Options(轻量结构体,非链式 DSL)----
|
||||
* 经 meow_widget_set_opts 一次性挂载,作用于任意控件(标准/自定义)。全部控件共用。
|
||||
* 哨兵语义:bg/fg==0=用控件/主题默认;stroke==0=无描边;stroke_w=描边宽;
|
||||
* 控件语义:W_PROGRESS 用 bg=轨道(0=surfaceVariant)、fg=填充(0=primary);见 meow_ui_widget.c 批5b;
|
||||
* radius==-1=控件默认(如按钮 10),>=0=指定圆角(0=直角);pad/margin=0=无;
|
||||
* disabled/selected=1=置位(立即反映到状态机位)。 */
|
||||
typedef struct meow_widget_opts {
|
||||
|
||||
@@ -2069,31 +2069,35 @@ void meow_widget_draw(meow_widget *w)
|
||||
break;
|
||||
}
|
||||
case W_PROGRESS: {
|
||||
/* 批5b:轨道/填充可由 opts 覆盖(opts.bg=轨道、opts.fg=填充);opts 未设则回主题默认
|
||||
* (surfaceVariant/primary)——兼容既有调用(如 hello demo、现在播放页取色后回退默认)。 */
|
||||
uint32_t track = widget_bg(w, th, th->surfaceVariant);
|
||||
uint32_t fill = widget_fg(w, th, th->primary);
|
||||
if (w->variant == 1) { /* 圆形(几何 = 整圆像素外接框;由此解回圆心/半径) */
|
||||
int thk = MEOW_PROGRESS_ARC_THK;
|
||||
int m = MEOW_PROGRESS_ARC_MARGIN;
|
||||
int ccx = w->x + w->w / 2, ccy = w->y + w->h / 2;
|
||||
int rr = w->w / 2 - m; /* 与 create 一致:回到调用方传入的半径 r */
|
||||
if (rr <= 0) break;
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, 0, 360, th->surfaceVariant);
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, 0, 360, track);
|
||||
if (w->value < 0) { /* 不定:按时间推进一段弧(App 在 on_tick 里重绘驱动) */
|
||||
int start = (int)((meow_ui_time_ms() / 30) % 360);
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, start - 90, 90, th->primary);
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, start - 90, 90, fill);
|
||||
} else if (w->value > 0) {
|
||||
int sweep = w->value * 360 / 100;
|
||||
if (sweep > 0) meow_gfx_ring_arc(ccx, ccy, rr, thk, -90, sweep, th->primary);
|
||||
if (sweep > 0) meow_gfx_ring_arc(ccx, ccy, rr, thk, -90, sweep, fill);
|
||||
}
|
||||
} else { /* 线性 */
|
||||
int thk = w->h > 0 ? w->h : 4;
|
||||
int yy = w->y + w->h / 2 - thk / 2;
|
||||
meow_ui_fill_rect(w->x, yy, w->w, thk, th->surfaceVariant);
|
||||
meow_ui_fill_rect(w->x, yy, w->w, thk, track);
|
||||
if (w->value < 0) { /* 不定:移动块 */
|
||||
int fw = w->w / 3;
|
||||
int pos = (int)((meow_ui_time_ms() / 12) % (w->w + fw)) - fw;
|
||||
meow_ui_fill_rect(w->x + pos, yy, fw, thk, th->primary);
|
||||
meow_ui_fill_rect(w->x + pos, yy, fw, thk, fill);
|
||||
} else if (w->value > 0) {
|
||||
int fw = w->value * w->w / 100;
|
||||
if (fw > 0) meow_ui_fill_rect(w->x, yy, fw, thk, th->primary);
|
||||
if (fw > 0) meow_ui_fill_rect(w->x, yy, fw, thk, fill);
|
||||
}
|
||||
}
|
||||
if (disabled) meow_ui_fill_rect_alpha(w->x, w->y, w->w, w->h, th->onSurface, 90);
|
||||
|
||||
Reference in new issue
Block a user