fix: 主题模板真正应用到设置页 UI

之前主题模板只影响了 getPanelBgColorInt/getPanelTextColorInt,
但设置页 UI(buildSettingsGroupPanelView)的颜色全部来自
getAnimalIslandTheme() 硬编码,完全不经过模板逻辑。

修复:
1. buildSettingsGroupPanelView 开头判断是否选了非 system 模板,
   若是则根据模板的 dayBg/dayText/nightBg/nightText 自动生成
   一套兼容 T 结构的配色,覆盖 Animal Island 的 T 对象
2. 模板值从 pendingUserCfg 读取(预览态)
3. setPendingValue 中当 key=THEME_TEMPLATE 时,通过
   replaceToolAppPage('settings_group') 重建整个设置页 UI,
   使模板切换立即生效
This commit is contained in:
7015725
2026-05-15 02:11:38 +08:00
parent 1c802f6948
commit cb01591369
4 changed files with 74 additions and 6 deletions

View File

@@ -154,6 +154,23 @@ FloatBallAppWM.prototype.setPendingValue = function(k, v) {
this.state.pendingUserCfg[k] = v;
this.state.pendingDirty = true;
if (this.state.previewMode) {
// 主题模板切换需要重建整个设置页 UI配色来自 buildSettingsGroupPanelView
if (String(k) === "THEME_TEMPLATE") {
try {
if (this.state.toolAppActive && this.replaceToolAppPage) {
this.replaceToolAppPage("settings_group");
} else {
// 非 ToolApp 模式:销毁旧设置面板重建
if (this.state.settingsPanel) {
this.safeRemoveView(this.state.settingsPanel, "settingsPanel");
this.state.settingsPanel = null;
this.state.settingsPanelLp = null;
this.state.addedSettings = false;
}
this.replaceToolAppPage("settings_group");
}
} catch(eReb) { safeLog(null, 'e', "catch " + String(eReb)); }
}
this.refreshPreview(k);
}
};