通知中心 ⑥⑦: 电源菜单chip + 勿扰面板内开关 + 单条左滑删除(agent-132)

- ⑥ 快捷行 5chip: WiFi/蓝牙/亮度/主题/电源菜单; 电源菜单chip点击=唤起 show_power_menu(真弹) + after_modal 还原
- 勿扰=面板内开关(notify.dnd bool, 零旁路), ncp_draw_list 按 urgency>=2 过滤; NCP_LIST_TOP 308
- ⑦ 单条通知行左滑删除: 跟手(mnp_swipe_clamp)+半程可回(未过阈值回弹), 过阈值滑出删除(mnp_swipe_delete/step)
- 手势区分: 行内左滑=删该条, 竖向=滚动, meow_edge_back(左缘<24) 优先; 局部刷该行带
- meow_ui.a 零改动(d249c6e6); launcher=115e2b1d; 宿主147断言PASS; 新增0warn
- SYSTEM_SETTINGS §1 加 notify.dnd; NOTIFICATION_SYSTEM §9 增 ⑥/⑦ 定案
This commit is contained in:
MeowOS committed 2026-08-30 17:23:04 +08:00
1 parent a8ec8377ed
commit 82b77d64b4
7 files changed
+452 -46

No files matched your search

@@ -193,4 +193,55 @@ static inline int mnp_anim_covered_bot(int top, int ph, int off)
return top + ph + off;
}
/* ---- 勿扰(DND)过滤(通知中心面板内开关 → 基于 urgency 过滤,纯逻辑,可单测)----
* urgency 见 meow_notif.h:0=LOW 低 / 1=NORMAL 普通 / 2=HIGH 高 / 3=CRITICAL 紧急(缺省 NORMAL)。
* dnd=0(关):全部显示;dnd=1(开):只显示 urgency>=2(HIGH/CRITICAL)。返回 1=应显示。 */
static inline int mnp_dnd_should_show(int urgency, int dnd)
{
if (!dnd) return 1;
return urgency >= 2;
}
/* ---- 单条通知行左滑删除(纯逻辑,可单测)----
* 交互(launcher run_notif_center):行内左横滑(横向主导+左移)→ 该行跟随左移(off<0,露出删除底);
* 松手过阈值 → meow_notif_dismiss + 行移除/重排;未过/反向滑回 → 回弹复原(跟手、半程可回)。
* 本组函数只做标量:clamp / 删除阈值 / 落位步进,不碰 fb/几何——供 launcher 与宿主单测共用。 */
/* 行左移 clamp:把手指位移钳到 [-row_w, 0](正向=右移钳 0;越左钳 -row_w=卡全滑出)。
* row_w=行宽(如 NCP_ROW_W),off<=0 表示左移程度(负得多=滑出多)。 */
static inline int mnp_swipe_clamp(int off, int row_w)
{
if (off > 0) off = 0;
if (off < -row_w) off = -row_w;
return off;
}
/* 松手删除判定:│off│ >= row_w*frac_pct/100 或 │off│ >= min_px → 返回 1(应删除);
* 否则 0(未过阈值/半程取消 → 回弹)。frac_pct 为行宽百分比(如 40)、min_px 为绝对像素保底
* (防极窄行/极小滑也判删,取二者较大者实际生效——满足「≥row_w 某比例 或 ≥ 阈值 px」)。 */
static inline int mnp_swipe_delete(int off, int row_w, int frac_pct, int min_px)
{
if (off > 0) off = 0;
int amt = -off; /* 左移幅度(px,>=0) */
if (amt >= row_w * frac_pct / 100) return 1;
if (amt >= min_px) return 1;
return 0;
}
/* 落位动画线性步进:off 沿方向向 target 走 dt_ms*px_per_ms,到 target 即停(可正/反向回弹或滑出)。
* dt_ms=距上次 tick 单调毫秒差;px_per_ms=速率(px/ms,如 3)。dt_ms<=0 或已到位返回原 off。
* 单调、可打断(任意时刻改 off 即反向),与面板开关平移动画(mnp_anim_step)同「状态时间轴」思想,
* 但按固定 px/ms 而非剩余比例(行位移远小于面板高,线性更稳)。 */
static inline int mnp_swipe_step(int off, int target, unsigned long long dt_ms, int px_per_ms)
{
if (dt_ms == 0 || off == target) return off;
int delta = target - off;
int dir = (delta < 0) ? -1 : 1;
long long absd = (long long)(dir < 0 ? -delta : delta);
long long step = (long long)dt_ms * px_per_ms;
if (step > absd) step = absd;
if (step < 1) step = 1; /* 单调前进,防快循环 dt 极小卡住 */
return off + dir * (int)step;
}
#endif /* MEOW_NOTIF_PANEL_H */