From 2b55e2bdd40771d5c88bc5f01afa4c6ca2e9914a Mon Sep 17 00:00:00 2001 From: 7015725 Date: Thu, 14 May 2026 18:23:31 +0800 Subject: [PATCH] style: refresh ToolApp visual back experience --- code/th_14_panels.js | 95 ++++++++++++++++++++++++++++++++++++++++---- code/th_15_extra.js | 28 +++++++++---- manifest.json | 10 ++--- manifest.sig | 2 +- 4 files changed, 114 insertions(+), 21 deletions(-) diff --git a/code/th_14_panels.js b/code/th_14_panels.js index 631fbc1..d957402 100644 --- a/code/th_14_panels.js +++ b/code/th_14_panels.js @@ -37,15 +37,34 @@ FloatBallAppWM.prototype.createSettingsHomeEntry = function(parent, title, desc, var self = this; var isDark = this.isDarkTheme(); var C = this.ui.colors; - var cardColor = isDark ? C.cardDark : C.cardLight; + var cardColor = isDark ? C.cardDark : android.graphics.Color.WHITE; var textColor = isDark ? C.textPriDark : C.textPriLight; var subTextColor = isDark ? C.textSecDark : C.textSecLight; var row = new android.widget.LinearLayout(context); row.setOrientation(android.widget.LinearLayout.HORIZONTAL); row.setGravity(android.view.Gravity.CENTER_VERTICAL); - row.setPadding(this.dp(14), this.dp(12), this.dp(12), this.dp(12)); - row.setBackground(this.ui.createRoundDrawable(cardColor, this.dp(14))); - try { row.setElevation(this.dp(2)); } catch(eElev) { safeLog(null, 'e', "catch " + String(eElev)); } + row.setPadding(this.dp(16), this.dp(14), this.dp(14), this.dp(14)); + row.setBackground(this.ui.createRippleDrawable(cardColor, isDark ? this.withAlpha(C.primary, 0.16) : this.withAlpha(C.primary, 0.10), this.dp(18))); + try { row.setElevation(this.dp(3)); } catch(eElev) { safeLog(null, 'e', "catch " + String(eElev)); } + + var badge = new android.widget.TextView(context); + var icon = "⚙"; + if (String(title).indexOf("按钮") >= 0) icon = "☷"; + else if (String(title).indexOf("布局") >= 0) icon = "▦"; + else if (String(title).indexOf("悬浮") >= 0) icon = "●"; + else if (String(title).indexOf("面板") >= 0) icon = "▣"; + else if (String(title).indexOf("主题") >= 0) icon = "◐"; + else if (String(title).indexOf("动画") >= 0) icon = "↝"; + else if (String(title).indexOf("日志") >= 0) icon = "⌁"; + badge.setText(icon); + badge.setTextColor(C.primary); + badge.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 19); + badge.setGravity(android.view.Gravity.CENTER); + badge.setTypeface(null, android.graphics.Typeface.BOLD); + badge.setBackground(this.ui.createRoundDrawable(this.withAlpha(C.primary, isDark ? 0.18 : 0.12), this.dp(15))); + var badgeLp = new android.widget.LinearLayout.LayoutParams(this.dp(46), this.dp(46)); + badgeLp.setMargins(0, 0, this.dp(14), 0); + row.addView(badge, badgeLp); var texts = new android.widget.LinearLayout(context); texts.setOrientation(android.widget.LinearLayout.VERTICAL); @@ -67,10 +86,13 @@ FloatBallAppWM.prototype.createSettingsHomeEntry = function(parent, title, desc, row.addView(texts, textLp); var tvGo = new android.widget.TextView(context); - tvGo.setText(String(actionText || "进入") + " ›"); + tvGo.setText(String(actionText || "进入") + " ›"); tvGo.setTextColor(C.primary); tvGo.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 13); tvGo.setTypeface(null, android.graphics.Typeface.BOLD); + tvGo.setGravity(android.view.Gravity.CENTER); + tvGo.setPadding(this.dp(10), this.dp(5), this.dp(10), this.dp(5)); + tvGo.setBackground(this.ui.createRoundDrawable(this.withAlpha(C.primary, isDark ? 0.16 : 0.10), this.dp(14))); row.addView(tvGo); row.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(v) { try { self.touchActivity(); } catch(eT) {} @@ -139,6 +161,65 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() { quick.addView(btnSave); panel.addView(quick); + var dash = new android.widget.LinearLayout(context); + dash.setOrientation(android.widget.LinearLayout.HORIZONTAL); + dash.setGravity(android.view.Gravity.CENTER_VERTICAL); + var dashLp = new android.widget.LinearLayout.LayoutParams(-1, this.dp(92)); + dashLp.setMargins(0, this.dp(6), 0, this.dp(12)); + + var totalButtons = 0; + var enabledButtons = 0; + try { + var btns = (this.state.pendingUserCfg && this.state.pendingUserCfg.buttons) || this.config.buttons || []; + totalButtons = btns.length || 0; + for (var bi = 0; bi < totalButtons; bi++) { if (!btns[bi] || btns[bi].enabled !== false) enabledButtons++; } + } catch(eCount) {} + + var titleCard = new android.widget.LinearLayout(context); + titleCard.setOrientation(android.widget.LinearLayout.VERTICAL); + titleCard.setGravity(android.view.Gravity.CENTER); + titleCard.setPadding(this.dp(12), 0, this.dp(12), 0); + titleCard.setBackground(this.ui.createRoundDrawable(isDark ? this.withAlpha(C.primary, 0.20) : this.withAlpha(C.primary, 0.14), this.dp(18))); + var titleMain = new android.widget.TextView(context); + titleMain.setText("ToolHub"); + titleMain.setTextColor(isDark ? C.textPriDark : C.textPriLight); + titleMain.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 22); + titleMain.setTypeface(null, android.graphics.Typeface.BOLD); + titleMain.setGravity(android.view.Gravity.CENTER); + titleCard.addView(titleMain, new android.widget.LinearLayout.LayoutParams(-1, -2)); + var titleSub = new android.widget.TextView(context); + titleSub.setText("悬浮球控制中心"); + titleSub.setTextColor(subTextColor); + titleSub.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 12); + titleSub.setGravity(android.view.Gravity.CENTER); + titleCard.addView(titleSub, new android.widget.LinearLayout.LayoutParams(-1, -2)); + var titleCardLp = new android.widget.LinearLayout.LayoutParams(0, -1, 1.25); + titleCardLp.setMargins(0, 0, this.dp(8), 0); + dash.addView(titleCard, titleCardLp); + + var statCard = new android.widget.LinearLayout(context); + statCard.setOrientation(android.widget.LinearLayout.VERTICAL); + statCard.setGravity(android.view.Gravity.CENTER); + statCard.setPadding(this.dp(10), 0, this.dp(10), 0); + statCard.setBackground(this.ui.createRoundDrawable(isDark ? C.cardDark : android.graphics.Color.WHITE, this.dp(18))); + var statLabel = new android.widget.TextView(context); + statLabel.setText("按钮启用"); + statLabel.setTextColor(subTextColor); + statLabel.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 12); + statLabel.setGravity(android.view.Gravity.CENTER); + statCard.addView(statLabel, new android.widget.LinearLayout.LayoutParams(-1, -2)); + var statVal = new android.widget.TextView(context); + statVal.setText(String(enabledButtons) + " / " + String(totalButtons)); + statVal.setTextColor(isDark ? C.textPriDark : C.textPriLight); + statVal.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 25); + statVal.setTypeface(null, android.graphics.Typeface.BOLD); + statVal.setGravity(android.view.Gravity.CENTER); + statCard.addView(statVal, new android.widget.LinearLayout.LayoutParams(-1, -2)); + var statLp = new android.widget.LinearLayout.LayoutParams(0, -1, 0.85); + statLp.setMargins(this.dp(8), 0, 0, 0); + dash.addView(statCard, statLp); + panel.addView(dash, dashLp); + var scroll = new android.widget.ScrollView(context); try { scroll.setOverScrollMode(android.view.View.OVER_SCROLL_NEVER); } catch(eOS) { safeLog(null, 'e', "catch " + String(eOS)); } try { scroll.setVerticalScrollBarEnabled(false); } catch(eSB) { safeLog(null, 'e', "catch " + String(eSB)); } @@ -159,7 +240,7 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() { })(defs[i]); } - panel.addView(scroll); + panel.addView(scroll, new android.widget.LinearLayout.LayoutParams(-1, 0, 1)); return panel; }; @@ -338,7 +419,7 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() { })(schema[i]); } - panel.addView(scroll); + panel.addView(scroll, new android.widget.LinearLayout.LayoutParams(-1, 0, 1)); return panel; }; diff --git a/code/th_15_extra.js b/code/th_15_extra.js index 18dc14a..d8d0222 100644 --- a/code/th_15_extra.js +++ b/code/th_15_extra.js @@ -567,13 +567,17 @@ FloatBallAppWM.prototype.buildToolAppPreviewBody = function(route) { var C = this.ui.colors; var body = new android.widget.LinearLayout(context); body.setOrientation(android.widget.LinearLayout.VERTICAL); - body.setBackground(this.ui.createRoundDrawable(isDark ? C.bgDark : C.bgLight, this.dp(18))); - try { body.setElevation(this.dp(6)); } catch (eElev) {} + var bodyBg = isDark ? C.bgDark : C.bgLight; + var bodyStroke = isDark ? C.dividerDark : C.dividerLight; + body.setBackground(this.ui.createStrokeDrawable(bodyBg, this.withAlpha(bodyStroke, 0.18), this.dp(1), this.dp(22))); + try { body.setClipToOutline(true); } catch(eClip) {} + try { body.setElevation(this.dp(8)); } catch (eElev) {} var bar = new android.widget.LinearLayout(context); bar.setOrientation(android.widget.LinearLayout.HORIZONTAL); bar.setGravity(android.view.Gravity.CENTER_VERTICAL); - bar.setPadding(this.dp(8), this.dp(8), this.dp(8), this.dp(6)); + bar.setPadding(this.dp(10), this.dp(10), this.dp(10), this.dp(6)); + bar.setBackground(this.ui.createRoundDrawable(isDark ? this.withAlpha(C.cardDark, 0.45) : this.withAlpha(C.cardLight, 0.55), this.dp(18))); var btnBack = this.ui.createFlatButton(this, "‹", C.primary, function() {}); btnBack.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 24); @@ -594,7 +598,9 @@ FloatBallAppWM.prototype.buildToolAppPreviewBody = function(route) { btnClose.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 18); btnClose.setEnabled(false); bar.addView(btnClose, new android.widget.LinearLayout.LayoutParams(this.dp(42), this.dp(38))); - body.addView(bar, new android.widget.LinearLayout.LayoutParams(-1, this.dp(52))); + var barLp = new android.widget.LinearLayout.LayoutParams(-1, this.dp(56)); + barLp.setMargins(this.dp(8), this.dp(8), this.dp(8), this.dp(4)); + body.addView(bar, barLp); var host = new android.widget.FrameLayout(context); var raw = this.buildPanelView(r); @@ -831,14 +837,18 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac var root = new android.widget.FrameLayout(context); var body = new android.widget.LinearLayout(context); body.setOrientation(android.widget.LinearLayout.VERTICAL); - body.setBackground(this.ui.createRoundDrawable(isDark ? C.bgDark : C.bgLight, this.dp(18))); - try { body.setElevation(this.dp(10)); } catch(eElev) { safeLog(null, 'e', "catch " + String(eElev)); } + var shellBg = isDark ? C.bgDark : C.bgLight; + var shellStroke = isDark ? C.dividerDark : C.dividerLight; + body.setBackground(this.ui.createStrokeDrawable(shellBg, this.withAlpha(shellStroke, 0.18), this.dp(1), this.dp(22))); + try { body.setClipToOutline(true); } catch(eClip) {} + try { body.setElevation(this.dp(14)); } catch(eElev) { safeLog(null, 'e', "catch " + String(eElev)); } root.addView(body, new android.widget.FrameLayout.LayoutParams(-1, -1)); var bar = new android.widget.LinearLayout(context); bar.setOrientation(android.widget.LinearLayout.HORIZONTAL); bar.setGravity(android.view.Gravity.CENTER_VERTICAL); - bar.setPadding(this.dp(8), this.dp(8), this.dp(8), this.dp(6)); + bar.setPadding(this.dp(10), this.dp(10), this.dp(10), this.dp(6)); + bar.setBackground(this.ui.createRoundDrawable(isDark ? this.withAlpha(C.cardDark, 0.45) : this.withAlpha(C.cardLight, 0.55), this.dp(18))); var btnBack = this.ui.createFlatButton(this, canBack ? "‹" : "", C.primary, function() { self.popToolAppPage("topbar"); @@ -863,7 +873,9 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac btnClose.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 18); btnClose.setPadding(this.dp(8), 0, this.dp(8), 0); bar.addView(btnClose, new android.widget.LinearLayout.LayoutParams(this.dp(42), this.dp(38))); - body.addView(bar, new android.widget.LinearLayout.LayoutParams(-1, this.dp(52))); + var barLp = new android.widget.LinearLayout.LayoutParams(-1, this.dp(56)); + barLp.setMargins(this.dp(8), this.dp(8), this.dp(8), this.dp(4)); + body.addView(bar, barLp); var host = new android.widget.FrameLayout(context); if (contentView) { diff --git a/manifest.json b/manifest.json index 4b7d05f..ee158f5 100644 --- a/manifest.json +++ b/manifest.json @@ -54,12 +54,12 @@ "size": 20386 }, "th_14_panels.js": { - "sha256": "65becc9f5bd4936bd12a338914a0dcbebe257e3fd42f1219e982ab917300d3e7", - "size": 239523 + "sha256": "47f49f5def41514c6a9a082fd06fcd0cc572a1650021309dbc946854e261ee0b", + "size": 244271 }, "th_15_extra.js": { - "sha256": "c46b15ddd46fe548813a927f45d525b5b799b209b56c6f05b355ef59c37770e1", - "size": 89681 + "sha256": "5db4df3da3920996fdbd078f5c463022770be77b2fca2817f72ffe98b88ad5f8", + "size": 90535 }, "th_16_entry.js": { "sha256": "e7c99c3dfbd6aedab05551426955081ae6cae034754f2f557cefa01dc75dc001", @@ -68,5 +68,5 @@ }, "keyId": "toolhub-targets-2026-rsa3072", "schema": 2, - "version": 20260513192204 + "version": 20260514102303 } diff --git a/manifest.sig b/manifest.sig index 3c3f4f8..44eba81 100644 --- a/manifest.sig +++ b/manifest.sig @@ -1 +1 @@ -ncqYbwM/RAG7BkNXDAmWjUnEsO+Fy4SyYu4LOvH9FgU6kQ2xojzYoKXLL1dmRs7xKCXEfiECFl+qI4+w6X4KETfC3O+N+X8UuhYKgi96WtLp70//7LzU75t8EQx/StPPckzsVD3UluoAdJ4Dv3PYdNSWN39HdQQaqDqT0+3VByRKITCxwmNfcE/oTXA15vIZ+UU01r6zZSTCgIiqofCpsM8PHz0/laQvpNiFxqGRgmFWZUUU1q/U+QFg1lUpu5yU9uESslwW6PiVSIWjqcWPqGVhfIvKgRo/11caKhuKERG78IzT0F/WSXLrmkndh1ItRH7789QLziyMrCQARUlzHkS0qEAChjb+v4Lb7k15dDtkyI7vAwEAykJNY6+WwZ2Xxb77+9ncwNHm2qxubjo6hUZc+CwHbk2JOgKLQSNv/mvUuKfa7pd7rZ+oKtBIEY56OIfYEHMaMt+ZDnU8WcYcuhlZyv3dnUPV28pPwzmlfQcq3TDiSYACZnP3ssa+ESaw +U9lCz4dSjxH2+Dshg24z1+Pn32UWlUDq+kQEXH8rjj69N7FRzrOVJKtFqxt6M/5UsBQCuyWZJK1QhJPwKRfXe/NjkdMHfqeFh8vfXooTGzoN3NYEY2Y4Z/DyHQnXwHdzSeOKb7xyJZwoEOQT8QEEfDFx17fCKdZPu4poz7ITyl7E3G4RuvVTEjVUmm21dcN+ksCX/820ci372fb1zK0t/k58f3lLI6NEkfPstnc+HdtU63ah42TJrKLMHup5m9yB/vcM21hmbAwNweUoICkqeSk+rLSkT1TjAETT2UDL9Y5okm6SP5lwDF2LH839t2xIh7XOe0F+tSmqiEMk7Ryfj6HpP9IcAO064cQpcHXbEv0pwKZ2CJFdbVB6oDKEu7WJONLenQa4cYHbvM1UDYi7yXxIxapkZYED0GbypsNAZAAucpORCcRLJ1CeNEjo+DB7NlxmaVhMv9fsou5geGGVLRMlOxPZIV8mhoPzFLHo/gPrAGZwJzvX/oH+b/oDaNh8