fix: 主题模板真正应用到主面板渲染

根本问题: buildPanelView('main') 构建主面板时用的是
ui.colors.bgLight/bgDark(Monet 配色),完全不经过
getPanelBgColorInt/getPanelTextColorInt 的模板填充逻辑。
updatePanelBackground 虽然封装了统一取色,但实际没有在
主面板构建流程中被调用。

修复:
1. buildPanelView('main') 末尾调用 updatePanelBackground(panel)
   应用统一主题色(Monet/模板/自定义)
2. 保留临时背景色避免构建过程中的裸窗口闪烁
This commit is contained in:
7015725
2026-05-15 02:08:58 +08:00
parent 49d73786bf
commit 1c802f6948
3 changed files with 15 additions and 10 deletions

View File

@@ -90,12 +90,15 @@ FloatBallAppWM.prototype.buildPanelView = function(panelType) {
var panel = new android.widget.LinearLayout(context);
panel.setOrientation(android.widget.LinearLayout.VERTICAL);
// 面板背景
var bgDr = new android.graphics.drawable.GradientDrawable();
// bgDr.setColor(bgColor);
bgDr.setColor(this.withAlpha(bgColor, this.config.PANEL_BG_ALPHA));
bgDr.setCornerRadius(this.dp(16));
panel.setBackground(bgDr);
// 面板背景:走统一主题色 API支持 Monet、模板、自定义
// 先用 updatePanelBackground 垫底,后续再加按钮等内容
// 先设一个临时背景避免裸窗口闪烁
try {
var tmpBg = new android.graphics.drawable.GradientDrawable();
tmpBg.setColor(this.withAlpha(bgColor, this.config.PANEL_BG_ALPHA));
tmpBg.setCornerRadius(this.dp(16));
panel.setBackground(tmpBg);
} catch(eTmp) {};
try { panel.setElevation(this.dp(8)); } catch(e) { safeLog(null, 'e', "catch " + String(e)); }
var padDp = this.config.PANEL_PADDING_DP;
@@ -260,6 +263,8 @@ FloatBallAppWM.prototype.buildPanelView = function(panelType) {
scroll.addView(grid);
panel.addView(scroll);
// 对主面板/查看器面板应用统一主题色(支持 Monet、模板、自定义
try { this.updatePanelBackground(panel); } catch(eTheme) { safeLog(null, 'e', "catch " + String(eTheme)); }
return panel;
};