0
Fork 0
mirror of https://github.com/Silent1566/webhtv.git synced 2026-10-18 07:09:16 +00:00

feat(theme): drive modal scrim alpha from scrimOpacity

Implements the approved path 1 (preserve the default look) and the agreed overlayOpacity editor label. The dialogs keep their own scrim colour - translucent white in light mode, translucent black in dark - and the user drives only its alpha, because substituting the token's colorScrim (translucent black in both modes) was measured to invert the light-mode scrim from lightening to darkening. ThemeController gains configuredScrimOpacity(boolean light), which reads the user's explicitly configured alpha and returns null when unset - the distinction from 'the value happens to equal the default' is what keeps the shipped rendering byte-identical - plus a pure applyScrimOpacity(int base, Float opacity) that returns the base untouched for null and otherwise replaces only the alpha byte. The mobile EpisodeDetailDialog and TmdbPersonDialog overlay literals now route through it, delegating to the shared maths, and the overlayOpacity label states it applies to the web theme only in all three locales. Automated evidence: theme unit tests pass with three new contracts - the dialogs must keep 0x99F4F7FA and must never reference colorScrim(), with arithmetic asserted directly (null is a strict no-op, 0f/1f map to 0x00/0xFF alpha, out-of-range clamps, 0.85f yields 0xD9F4F7FA); the accessor distinguishes unset from a value equal to the token baseline (0.322f still reports as a user value); and the three locale labels exist. Regression coverage over theme.*, ui.dialog.*, EpisodeAdapterTest, and TmdbDetailActivityLayoutTest - all of which reference the changed files - passes, as do the mobile and leanback javac compiles. Honest gap: no device screenshot was captured because both dialogs are only reachable through the TMDB detail flow and this device currently has no watch history or site configuration, and the earlier 'network blocked' reading was itself wrong (TMDB drops ICMP and returned 401 only for a keyless request; with the device's configured key search/person returns 200 with real data), so the runtime pixel effect still lacks device confirmation and is recorded as such with a follow-up procedure.

Task-Guard: THEME-SCRIM-WIRE-P1-20260926

Verification: 按路径 1(保默认外观)实现 scrimOpacity 接线 + overlayOpacity 编辑器标注。设计:不把 token 的 colorScrim 灌进弹窗,而是保留每个弹窗自己的遮罩色相,只让用户控制 alpha,从而默认外观逐字节不变。实现:ThemeController 新增 configuredScrimOpacity(boolean light)——读取 profile 中用户显式设置的 scrim alpha,未设置返回 null(关键:必须区分'未设置'与'恰好等于默认值'),并按调用方自己解析的 light/dark 选择槽集;新增纯函数 applyScrimOpacity(int base, Float opacity)——null 原样返回、否则只替换 alpha 字节保留 RGB。mobile EpisodeDetailDialog.java:289 与 TmdbPersonDialog.java:372 的 overlay 由字面量改为 applyScrimOpacity(light ? 0x99F4F7FA : <深色字面量>, light),本地 helper 委托共享函数。overlayOpacity 的 label 在三份 strings.xml 追加'仅 Web 主题生效'。自动化证据(全部通过):(1) :app:testMobileArm64_v8aDebugUnitTest --tests 'com.fongmi.android.tv.theme.*' BUILD SUCCESSFUL,新增 3 条契约——scrimOpacityKeepsTheDialogOwnColourAndOnlyMovesAlphaWhenSet 断言两弹窗保留 0x99F4F7FA、必须不出现 colorScrim()、必须委托共享函数,并直接断言算术行为(null 严格等于 0x99F4F7FA/0xB3000000、0f→0x00F4F7FA、1f→0xFFF4F7FA、-1f/2f 被夹取、0.85f→0xD9F4F7FA);configuredScrimOpacityReportsUnsetSeparatelyFromAnyValue 用反射注入 profile,断言未设置→null、仅设 light 时 dark 仍 null、设成 0.322f(等于 token 基线)仍报用户值而非未设置;overlayOpacityIsLabelledAsWebOnly 断言三语文案。(2) 回归:同任务覆盖 theme.*、ui.dialog.*、EpisodeAdapterTest、TmdbDetailActivityLayoutTest 全部通过(这些测试直接引用被改动文件)。(3) 双 flavor :app:compileMobileArm64_v8aDebugJavaWithJavac 与 :app:compileLeanbackArm64_v8aDebugJavaWithJavac 均 BUILD SUCCESSFUL。如实记录的验证缺口:未取得设备端截图证据——两弹窗仅能从 TMDB 详情路径进入,当前设备 192.168.50.3:5559 无观看历史、无站点配置,无法在合理成本内到达;同时排除了'网络阻塞'误判(TMDB 封 ICMP 且裸请求缺 api_key 才 401,用设备内配置 key 实测 search/person 返回 200 带真实数据),故该弹窗在有内容源设备上应可打开但本次未实测。因此 scrimOpacity 目前只有单元级行为证据、缺设备级像素确认,已在文档 13.3 节明确标注并给出后续补验步骤(设两极值打开 TmdbPersonDialog,遮罩区差异应>0、分隔线应 0 差异)。设备偏好已按字节还原为基线 /tmp/sc_base.xml。

Task-Guard: THEME-SCRIM-WIRE-P1-20260926
This commit is contained in:
Silent1566 2026-09-26 02:55:25 +08:00
commit 350ea614bb
8 changed files with 205 additions and 5 deletions