From 342171e2aca95129578b71dbf74d5cb7587cf97c Mon Sep 17 00:00:00 2001 From: 7015725 Date: Mon, 18 May 2026 03:49:54 +0800 Subject: [PATCH] fix: adapt settings pages to Monet theme --- code/th_04_theme.js | 34 ++++++++++++++++++++++++++++------ code/th_13_panel_ui.js | 20 +++++++++++++------- code/th_14_panels.js | 15 +++++++++------ manifest.json | 14 +++++++------- manifest.sig | 2 +- 5 files changed, 58 insertions(+), 27 deletions(-) diff --git a/code/th_04_theme.js b/code/th_04_theme.js index c190a55..78bf825 100644 --- a/code/th_04_theme.js +++ b/code/th_04_theme.js @@ -113,7 +113,12 @@ FloatBallAppWM.prototype.ui = { // Monet 扩展字段(供面板直接使用) _monetSurface: android.graphics.Color.parseColor("#F8F9FA"), _monetOnSurface: android.graphics.Color.parseColor("#1F1F1F"), + _monetSurfaceVariant: android.graphics.Color.parseColor("#E1E3E1"), + _monetSurfaceContainerLow: android.graphics.Color.parseColor("#F1F3F4"), + _monetSurfaceContainer: android.graphics.Color.parseColor("#ECEEEF"), + _monetSurfaceContainerHigh: android.graphics.Color.parseColor("#E6E8EA"), _monetOutline: android.graphics.Color.parseColor("#747775"), + _monetOutlineVariant: android.graphics.Color.parseColor("#C4C7C5"), _monetOnPrimary: android.graphics.Color.parseColor("#FFFFFF"), _monetPrimaryContainer: android.graphics.Color.parseColor("#D3E3FD"), _monetOnPrimaryContainer: android.graphics.Color.parseColor("#041E49"), @@ -400,6 +405,9 @@ var MonetColorProvider = { surface: android.graphics.Color.parseColor("#F8F9FA"), onSurface: android.graphics.Color.parseColor("#1F1F1F"), surfaceVariant: android.graphics.Color.parseColor("#E1E3E1"), + surfaceContainerLow: android.graphics.Color.parseColor("#F1F3F4"), + surfaceContainer: android.graphics.Color.parseColor("#ECEEEF"), + surfaceContainerHigh: android.graphics.Color.parseColor("#E6E8EA"), onSurfaceVariant: android.graphics.Color.parseColor("#5F6368"), outline: android.graphics.Color.parseColor("#747775"), outlineVariant: android.graphics.Color.parseColor("#C4C7C5"), @@ -421,6 +429,9 @@ var MonetColorProvider = { surface: android.graphics.Color.parseColor("#131314"), onSurface: android.graphics.Color.parseColor("#E3E3E3"), surfaceVariant: android.graphics.Color.parseColor("#49454F"), + surfaceContainerLow: android.graphics.Color.parseColor("#1B1B1F"), + surfaceContainer: android.graphics.Color.parseColor("#202124"), + surfaceContainerHigh: android.graphics.Color.parseColor("#2B2C30"), onSurfaceVariant: android.graphics.Color.parseColor("#C4C7C5"), outline: android.graphics.Color.parseColor("#8E918F"), outlineVariant: android.graphics.Color.parseColor("#49454F"), @@ -445,6 +456,9 @@ var MonetColorProvider = { surface: "system_neutral1_900", onSurface: "system_neutral1_100", surfaceVariant: "system_neutral2_700", + surfaceContainerLow: "system_neutral1_800", + surfaceContainer: "system_neutral1_800", + surfaceContainerHigh: "system_neutral1_700", onSurfaceVariant: "system_neutral2_200", outline: "system_neutral2_400", outlineVariant: "system_neutral2_700", @@ -462,6 +476,9 @@ var MonetColorProvider = { surface: "system_neutral1_10", onSurface: "system_neutral1_900", surfaceVariant: "system_neutral2_100", + surfaceContainerLow: "system_neutral1_50", + surfaceContainer: "system_neutral1_100", + surfaceContainerHigh: "system_neutral1_200", onSurfaceVariant: "system_neutral2_700", outline: "system_neutral2_500", outlineVariant: "system_neutral2_200", @@ -613,19 +630,19 @@ FloatBallAppWM.prototype.refreshMonetColors = function(forceDark) { // 浅色配色 c.bgLight = ml.surface; - c.cardLight = ml.surfaceVariant; + c.cardLight = ml.surfaceContainerLow || ml.surfaceVariant; c.textPriLight = ml.onSurface; c.textSecLight = ml.onSurfaceVariant; - c.dividerLight = ml.outline; - c.inputBgLight = ml.surface; + c.dividerLight = ml.outlineVariant || ml.outline; + c.inputBgLight = ml.surfaceContainerHigh || ml.surface; // 深色配色 c.bgDark = md.surface; - c.cardDark = md.surfaceVariant; + c.cardDark = md.surfaceContainerLow || md.surfaceVariant; c.textPriDark = md.onSurface; c.textSecDark = md.onSurfaceVariant; - c.dividerDark = md.outline; - c.inputBgDark = md.surface; + c.dividerDark = md.outlineVariant || md.outline; + c.inputBgDark = md.surfaceContainerHigh || md.surface; // 当前主题配色(随主题切换) c.primary = m.primary; @@ -640,7 +657,12 @@ FloatBallAppWM.prototype.refreshMonetColors = function(forceDark) { // 扩展:完整 Monet 语义字段(供面板方法直接使用) c._monetSurface = m.surface; c._monetOnSurface = m.onSurface; + c._monetSurfaceVariant = m.surfaceVariant; + c._monetSurfaceContainerLow = m.surfaceContainerLow || m.surfaceVariant; + c._monetSurfaceContainer = m.surfaceContainer || m.surfaceVariant; + c._monetSurfaceContainerHigh = m.surfaceContainerHigh || m.surfaceVariant; c._monetOutline = m.outline; + c._monetOutlineVariant = m.outlineVariant || m.outline; c._monetOnPrimary = m.onPrimary; c._monetPrimaryContainer = m.primaryContainer; c._monetOnPrimaryContainer = m.onPrimaryContainer; diff --git a/code/th_13_panel_ui.js b/code/th_13_panel_ui.js index 694c6e0..baa711d 100644 --- a/code/th_13_panel_ui.js +++ b/code/th_13_panel_ui.js @@ -3,7 +3,9 @@ FloatBallAppWM.prototype.createSectionHeader = function(item, parent) { var isDark = this.isDarkTheme(); var C = this.ui.colors; - var color = C.primary; + var T = this.getAnimalIslandTheme ? this.getAnimalIslandTheme() : null; + try { if (this.applySettingsTheme && T) this.applySettingsTheme(T, isDark, C, this.state.pendingUserCfg || this.config); } catch(eTheme) { safeLog(null, 'e', "catch " + String(eTheme)); } + var color = T ? T.primary : C.primary; var h = new android.widget.TextView(context); h.setText(String(item.name || "")); @@ -17,11 +19,14 @@ FloatBallAppWM.prototype.createSectionHeader = function(item, parent) { FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivider) { var isDark = this.isDarkTheme(); var C = this.ui.colors; - var textColor = isDark ? C.textPriDark : C.textPriLight; - var secColor = isDark ? C.textSecDark : C.textSecLight; - var dividerColor = isDark ? C.dividerDark : C.dividerLight; - var primary = C.primary; - var switchOff = isDark ? (0xFF555555 | 0) : (0xFFCCCCCC | 0); + var T = this.getAnimalIslandTheme ? this.getAnimalIslandTheme() : null; + try { if (this.applySettingsTheme && T) this.applySettingsTheme(T, isDark, C, this.state.pendingUserCfg || this.config); } catch(eTheme) { safeLog(null, 'e', "catch " + String(eTheme)); } + var textColor = T ? T.text : (isDark ? C.textPriDark : C.textPriLight); + var secColor = T ? T.sub : (isDark ? C.textSecDark : C.textSecLight); + var dividerColor = T ? T.stroke : (isDark ? C.dividerDark : C.dividerLight); + var primary = T ? T.primary : C.primary; + var inputBgColor = T ? T.card2 : (isDark ? C.inputBgDark : C.inputBgLight); + var switchOff = T ? T.card2 : (isDark ? (0xFF555555 | 0) : (0xFFCCCCCC | 0)); // 增加内边距 var padH = this.dp(16); @@ -271,7 +276,8 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi et.setText(String(curVal)); et.setTextColor(textColor); et.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 14); - et.setBackground(self.ui.createRoundDrawable(isDark ? C.inputBgDark : C.inputBgLight, self.dp(6))); + try { et.setHintTextColor(secColor); } catch(eHint) { safeLog(null, 'e', "catch " + String(eHint)); } + et.setBackground(self.ui.createStrokeDrawable(inputBgColor, dividerColor, self.dp(1), self.dp(8))); et.setPadding(self.dp(8), self.dp(8), self.dp(8), self.dp(8)); et.setSingleLine(true); diff --git a/code/th_14_panels.js b/code/th_14_panels.js index dd09085..fda08b5 100644 --- a/code/th_14_panels.js +++ b/code/th_14_panels.js @@ -10,20 +10,23 @@ FloatBallAppWM.prototype.applySettingsTheme = function(T, isDark, C, cfgTpl) { var Color = android.graphics.Color; var monetBg = isDark ? C.bgDark : C.bgLight; var monetTxt = isDark ? C.textPriDark : C.textPriLight; - var monetCard = isDark ? C.cardDark : C.cardLight; var monetSub = isDark ? C.textSecDark : C.textSecLight; + var monetCard = C._monetSurfaceContainerLow || (isDark ? C.cardDark : C.cardLight); + var monetCard2 = C._monetSurfaceContainerHigh || (isDark ? C.inputBgDark : C.inputBgLight); var monetPrimary = C.primary; + var monetPrimaryContainer = C._monetPrimaryContainer || this.withAlpha(monetPrimary, isDark ? 0.28 : 0.14); + var monetOnPrimaryContainer = C._monetOnPrimaryContainer || monetPrimary; var monetOnP = C._monetOnPrimary || (isDark ? Color.parseColor("#062E6F") : Color.WHITE); T.bg = monetBg; T.card = monetCard; - T.card2 = monetCard; + T.card2 = monetCard2; T.text = monetTxt; T.sub = monetSub; T.primary = monetPrimary; - T.primaryDeep = monetPrimary; - T.primarySoft = isDark ? this.withAlpha(monetPrimary, 0.20) : this.withAlpha(monetPrimary, 0.10); - T.brown = monetSub; - T.stroke = isDark ? this.withAlpha(monetTxt, 0.16) : this.withAlpha(monetTxt, 0.12); + T.primaryDeep = monetOnPrimaryContainer; + T.primarySoft = monetPrimaryContainer; + T.brown = monetOnPrimaryContainer; + T.stroke = C._monetOutlineVariant || (isDark ? this.withAlpha(monetTxt, 0.16) : this.withAlpha(monetTxt, 0.12)); T.onPrimary = monetOnP; } catch(e) { safeLog(null, 'e', "catch " + String(e)); } }; diff --git a/manifest.json b/manifest.json index 6527b63..4f08a34 100644 --- a/manifest.json +++ b/manifest.json @@ -14,8 +14,8 @@ "size": 5598 }, "th_04_theme.js": { - "sha256": "b56b9013de31bf191a786359f1371b07375c3aa60bbb15bdf318dd39945858d7", - "size": 38293 + "sha256": "02e83c839a54c24fa9c178eab4f165e3181294750dd4bda57a0e7ff5eb23a52d", + "size": 39909 }, "th_05_persistence.js": { "sha256": "2b5b667912c8c1a808d7925fc619e917b46244a73405af1eca9dd567312f9b9d", @@ -50,12 +50,12 @@ "size": 2362 }, "th_13_panel_ui.js": { - "sha256": "e29f3375c02a834dd678b095e179589008b5f40a37ed12b88263d8a8913014c3", - "size": 20392 + "sha256": "5e9fc29b1156a74623325132f4ad60187892a87749e9b6d73c7fd5fa69e596f4", + "size": 21198 }, "th_14_panels.js": { - "sha256": "6de693ddaaef58479aabfdfaab6d25eedfd95ce58e446064168f4591919a85f2", - "size": 245961 + "sha256": "e1d40451a3096530931b6eace1bbf1edb4ff01b3a213efb302e68e6fb42c5c0c", + "size": 246276 }, "th_15_extra.js": { "sha256": "b607620f1900c1bd93ccbec8d901d4de53b3d36e9373877f4264442f79b9b956", @@ -68,5 +68,5 @@ }, "keyId": "toolhub-targets-2026-rsa3072", "schema": 2, - "version": 20260514183135 + "version": 20260517194928 } diff --git a/manifest.sig b/manifest.sig index 043f7a8..d77ccca 100644 --- a/manifest.sig +++ b/manifest.sig @@ -1 +1 @@ -cDTR/zljOOq1QJih3E682NuyYsbqs1tLLHp2zMJzWIxBcjeSkuI5DT4jgPQcpaqakWt0pu7zlIcI1iB1qT/51323zYhpeHOkMCisA9BnD38NetdOHtr13C/SGCJcGeMzhceQC/4XFuvCtnOfo5EL6BVuZpASrx0l89Axg24yp+lYNfOrr+ytzWhABcTWlY7nEVR8es3Gh8HKDC19mAGU61t3S6G0gPzw5o3WjqCET0yrVsOZmkfmMjCHhHsIWY5KYZet33oQ3fIrKSRFBofMD4fsDx4+ypyNgvAqdHqDQY79iZQJJ0aoaqBNFdL2+0kw1nq2L+RtCm7ccVzG9aDCGrmOSvjUt/saFr4lb19umtFFUUUL6Cw7aJF6yI0nn1c5QwEhlBLMcs1DeusC/4M9nQhfEkwTkOb8Jj7Dd1k4gZMB7nGz5TkbnHieY9ZWAAdSVKqtpzixLCBfi526/RBKKBGGprm9xOmhZEWYOXwAsFa9z67yRMVJPZYGCUvIn2+9 +HnPhwCpOpEQZvfeHZQ58Aw/ogq+BpXi7IWBDv+KESF8KK8AMv3ak51W2clw51PHH4MSI+2OJh4mKtcYk22urmkIkL2g/k6+mFbKf3GFNfBQADJjbJj6yrRHXMG55fAomSntmvw+SeLSSbSGKNONl50wbSgZvbbFFUnZ2+rx6HgdF70xpSadjaIl3+YeCRoZuxye6Z9cMveAQHfQWM/F9Ley46zeEKZRKXV+t7eP8ErEqZxG2DNqqLodJG88NB5x+CTdmNcsBVqNgUwHjpTImJyjVtxr/wt9E/f83WB6LTc6hugX5ccu3P4cjYsItcWujmcnnnrreHckBHCjbimdrL5j6skssRUKgFNC1VKwSsBF8fu2bDa3vxP7h2dCcVvFLgbisP8hSgGj8PPbezjMYCxmF1WmdK+CLMPWD9khpDu9VqPle3IdxII0VmCUVMZXaY81awLgsdocI9dkofmJvEDLHPILC2PPkf7gsc8yfHmSWFW4ZqbhuavGzye0PhpDQ