Fix inert ToolApp UI actions

This commit is contained in:
7015725
2026-05-22 04:40:56 +08:00
parent 32fe099fab
commit 3511b3f1ce
4 changed files with 65 additions and 22 deletions

View File

@@ -237,14 +237,46 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi
// 透明波纹背景 // 透明波纹背景
btn.setBackground(self.ui.createTransparentRippleDrawable(primary, self.dp(16))); btn.setBackground(self.ui.createTransparentRippleDrawable(primary, self.dp(16)));
btn.setOnClickListener(new android.view.View.OnClickListener({ function runSettingAction() {
onClick: function(v) {
try { try {
self.touchActivity(); self.touchActivity();
if (item.action === "open_btn_mgr") { var action = String(item.action || "");
if (action === "open_btn_mgr") {
self.showPanelAvoidBall("btn_editor"); self.showPanelAvoidBall("btn_editor");
return;
} }
} catch(e) { safeLog(null, 'e', "catch " + String(e)); } if (action === "open_schema_editor") {
self.showPanelAvoidBall("schema_editor");
return;
}
if (action === "open_settings") {
self.showPanelAvoidBall("settings");
return;
}
if (action === "open_manual" || action === "open_doc") {
var intent = new android.content.Intent(android.content.Intent.ACTION_VIEW);
intent.setData(android.net.Uri.parse("https://xin-blog.com/114.html"));
intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return;
}
if (action && (action.indexOf("http://") === 0 || action.indexOf("https://") === 0)) {
var urlIntent = new android.content.Intent(android.content.Intent.ACTION_VIEW);
urlIntent.setData(android.net.Uri.parse(action));
urlIntent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(urlIntent);
return;
}
self.toast(action ? ("暂不支持动作: " + action) : "动作未配置");
} catch(e) {
try { self.toast("动作执行失败: " + String(e)); } catch(eToast) {}
safeLog(null, 'e', "setting action fail " + String(e));
}
}
btn.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(v) {
runSettingAction();
} }
})); }));
row.addView(btn); row.addView(btn);
@@ -252,12 +284,7 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi
// 行点击也触发 // 行点击也触发
row.setOnClickListener(new android.view.View.OnClickListener({ row.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(v) { onClick: function(v) {
try { runSettingAction();
self.touchActivity();
if (item.action === "open_btn_mgr") {
self.showPanelAvoidBall("btn_editor");
}
} catch(e) { safeLog(null, 'e', "catch " + String(e)); }
} }
})); }));

View File

@@ -614,6 +614,7 @@ FloatBallAppWM.prototype.makeToolAppStackEntry = function(route) {
}; };
FloatBallAppWM.prototype.buildToolAppPreviewBody = function(entry) { FloatBallAppWM.prototype.buildToolAppPreviewBody = function(entry) {
var self = this;
var oldGroupKey = null; var oldGroupKey = null;
var hasOldGroupKey = false; var hasOldGroupKey = false;
var r = "settings"; var r = "settings";
@@ -650,10 +651,13 @@ FloatBallAppWM.prototype.buildToolAppPreviewBody = function(entry) {
bar.setBackground(this.ui.createStrokeDrawable(T.card, this.withAlpha(T.stroke, isDark ? 0.30 : 0.45), this.dp(1), this.dp(20))); bar.setBackground(this.ui.createStrokeDrawable(T.card, this.withAlpha(T.stroke, isDark ? 0.30 : 0.45), this.dp(1), this.dp(20)));
try { bar.setElevation(this.dp((spec && (spec.isExpandedWidth || spec.isWideWidth)) ? 1 : 2)); } catch(eBarElev) {} try { bar.setElevation(this.dp((spec && (spec.isExpandedWidth || spec.isWideWidth)) ? 1 : 2)); } catch(eBarElev) {}
var btnBack = this.ui.createFlatButton(this, "", T.brown, function() {}); function handlePreviewBackClick() {
try { self.toast("这是返回预览,松手后才会返回"); } catch(eToast) {}
}
var btnBack = this.ui.createFlatButton(this, "", T.brown, handlePreviewBackClick);
btnBack.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 24); btnBack.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 24);
btnBack.setPadding(this.dp(8), 0, this.dp(8), 0); btnBack.setPadding(this.dp(8), 0, this.dp(8), 0);
try { btnBack.setClickable(false); btnBack.setAlpha(0.45); } catch(eBackClick) {} try { btnBack.setAlpha(0.62); } catch(eBackClick) {}
try { btnBack.setBackground(this.ui.createStrokeDrawable(T.primarySoft, this.withAlpha(T.primaryDeep, isDark ? 0.30 : 0.22), this.dp(1), this.dp(18))); } catch(eBackBg) {} try { btnBack.setBackground(this.ui.createStrokeDrawable(T.primarySoft, this.withAlpha(T.primaryDeep, isDark ? 0.30 : 0.22), this.dp(1), this.dp(18))); } catch(eBackBg) {}
bar.addView(btnBack, new android.widget.LinearLayout.LayoutParams(this.dp(42), this.dp(38))); bar.addView(btnBack, new android.widget.LinearLayout.LayoutParams(this.dp(42), this.dp(38)));
@@ -670,11 +674,23 @@ FloatBallAppWM.prototype.buildToolAppPreviewBody = function(entry) {
bar.addView(tvTitle, titleLp); bar.addView(tvTitle, titleLp);
var rightText = r === "settings" ? "📖 岛务手册" : "✕"; var rightText = r === "settings" ? "📖 岛务手册" : "✕";
var btnClose = this.ui.createFlatButton(this, rightText, T.primaryDeep, function() {}); function handlePreviewRightClick() {
try {
if (r === "settings") {
var intent = new android.content.Intent(android.content.Intent.ACTION_VIEW);
intent.setData(android.net.Uri.parse("https://xin-blog.com/114.html"));
intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return;
}
self.toast("这是返回预览,松手后才会返回");
} catch(eDoc) { try { self.toast("无法打开文档链接"); } catch(eToast) {} }
}
var btnClose = this.ui.createFlatButton(this, rightText, T.primaryDeep, handlePreviewRightClick);
btnClose.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, r === "settings" ? 12 : 18); btnClose.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, r === "settings" ? 12 : 18);
btnClose.setTypeface(null, android.graphics.Typeface.BOLD); btnClose.setTypeface(null, android.graphics.Typeface.BOLD);
btnClose.setPadding(this.dp(10), 0, this.dp(10), 0); btnClose.setPadding(this.dp(10), 0, this.dp(10), 0);
try { btnClose.setClickable(false); btnClose.setAlpha(0.45); } catch(eRightClick) {} try { btnClose.setAlpha(0.62); } catch(eRightClick) {}
try { btnClose.setBackground(this.ui.createStrokeDrawable(T.primarySoft, this.withAlpha(T.primaryDeep, isDark ? 0.30 : 0.22), this.dp(1), this.dp(18))); } catch(eRightBg) {} try { btnClose.setBackground(this.ui.createStrokeDrawable(T.primarySoft, this.withAlpha(T.primaryDeep, isDark ? 0.30 : 0.22), this.dp(1), this.dp(18))); } catch(eRightBg) {}
bar.addView(btnClose, new android.widget.LinearLayout.LayoutParams(this.dp(104), this.dp(38))); bar.addView(btnClose, new android.widget.LinearLayout.LayoutParams(this.dp(104), this.dp(38)));
var barLp = new android.widget.LinearLayout.LayoutParams(-1, topBarHeight); var barLp = new android.widget.LinearLayout.LayoutParams(-1, topBarHeight);

View File

@@ -50,16 +50,16 @@
"size": 2362 "size": 2362
}, },
"th_13_panel_ui.js": { "th_13_panel_ui.js": {
"sha256": "5e9fc29b1156a74623325132f4ad60187892a87749e9b6d73c7fd5fa69e596f4", "sha256": "9052e01ccdc0af29615ef8e72550d7d312240f9ab36ebfb66e673c92ab2e4b9c",
"size": 21198 "size": 22308
}, },
"th_14_panels.js": { "th_14_panels.js": {
"sha256": "ad0db8e379445b83fd3c86d335b12f084498e1dd876550039a25a9c9d7e12803", "sha256": "ad0db8e379445b83fd3c86d335b12f084498e1dd876550039a25a9c9d7e12803",
"size": 294962 "size": 294962
}, },
"th_15_extra.js": { "th_15_extra.js": {
"sha256": "f607f0a5e66a7e9a5ef0c2af8eeda78200138c08438bd6a315d1dc7235e55dc7", "sha256": "5084f4db1afd0e681fbdf291adbc10df44eccb43775e86ed1cbe0b8f0e49a25a",
"size": 104599 "size": 105271
}, },
"th_16_entry.js": { "th_16_entry.js": {
"sha256": "6c59d9891cd010647f84c3db93f1cf95c7bbfb758470ea21044bf72eb8ff73d1", "sha256": "6c59d9891cd010647f84c3db93f1cf95c7bbfb758470ea21044bf72eb8ff73d1",
@@ -68,5 +68,5 @@
}, },
"keyId": "toolhub-targets-2026-rsa3072", "keyId": "toolhub-targets-2026-rsa3072",
"schema": 2, "schema": 2,
"version": 20260521202619 "version": 20260521204038
} }

View File

@@ -1 +1 @@
C+0TNFqO1QyV/26OJ39wLL93yh2hYFvWynTRwctmWnpLwF8sDUiTxhija5KG3yvJtvQ8cVe6JFHqbCkx/IFuiXVg8xnsr/L91vSiJYdRQvsH/nSl9yuUMik0v5OyMYebVHwsoM/TysbvsH8SdGnbkWjjWsK1wLJxdKrk5PlbQHz7ZskMOJoQn/LUkt9DhTuapalyBZrTh3UQktG/Xg9rRhZUKafgBLBfb9RD1F8jgebY2MN+I7AkeMMIhUv9Eob/pmw598fI7Pr0MKgDVN4Ge8ZIINhthyjFcFz+owToubauW/iAneGEROeZJ9/874c071tyfuCZhH6TMc7BH26VOmv7bq+Rqr0EsRNhFfxnPmPczIX+92Tgp0ppI+xErBN+/rFtLnPBPbfhTTbDt+Q88gxH0jx95Nx9e4Kz/dh1ffJx1oUxGcI78JkyEo68QCIhKgKTmhw7FoQRYoV33Fl+jRxRtBqbMww5oTZd+0u8Wg7FR4iqHDe7o6SlCjnCT7sk XJPl0OJwoiPUCu5a2JUmaeaAW4j1Eet5CNOW8jFBom4DtoIbpavxvk8nIub1QkDnPX71reXt8nfspunPp+tFfe/f5hL5+zw9FCerduSA9fWsDz6GzimXe2iywSWzlI/XMHModCAA+HQnNmuYuR+YdjI295uAG7f972+Ecyd6J91JJzx0DbQww3FuvxmmDZW1MyFBkQbyIolJUrvhuNnaCZGEDCnO5KKnXmYguoPQ2HwbYFQ/o7YWJtaAbdqbwQ9TLeRFxKm7eiXRIKzT1PgrMfd+AJcTizfugBhv5EV4EgDtWN6hoRF+0TXIZ3PEhdxUoDrcuxivJ/IisP+MtDBH3pgyRlDXMT8osHhiPJnBhcEmydNoLYFDhP6n6g8SQICvUgNgh4PaHEuQ0Fu6kiYjodvQKNgr1hTuvv0VMrNyOcWa8z2c+bx6tIDVPtwa+9wonEgul0Ub1dchmBz0u4L49D0s9IrFbXJGXxsBjIOJTGyqwF+oeQautymOlqhmcHnF