Fix ToolApp edge back strip defaults

This commit is contained in:
Hermes
2026-05-22 05:52:12 +08:00
parent a5bd0a5b15
commit be2156a634
6 changed files with 55 additions and 41 deletions

View File

@@ -100,9 +100,9 @@ var ConfigValidator = {
LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: { type: "int", min: 8, max: 80, default: 28 }, LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: { type: "int", min: 8, max: 80, default: 28 },
LONG_PRESS_VIBRATE_MS: { type: "int", min: 10, max: 100, default: 40 }, LONG_PRESS_VIBRATE_MS: { type: "int", min: 10, max: 100, default: 40 },
CLICK_SLOP_DP: { type: "int", min: 2, max: 20, default: 6 }, CLICK_SLOP_DP: { type: "int", min: 2, max: 20, default: 6 },
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 48 }, TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 24 },
ENABLE_TOOLAPP_INNER_BACK_STRIPS: { type: "bool", default: true }, ENABLE_TOOLAPP_INNER_BACK_STRIPS: { type: "bool", default: false },
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: { type: "bool", default: false }, ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: { type: "bool", default: true },
TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 1, max: 480, default: 72 }, TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 1, max: 480, default: 72 },
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 180 }, TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 180 },
@@ -736,9 +736,9 @@ var ConfigManager = {
LONG_PRESS_MS: 520, LONG_PRESS_MS: 520,
LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: 28, LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: 28,
CLICK_SLOP_DP: 6, CLICK_SLOP_DP: 6,
TOOLAPP_BACK_EDGE_WIDTH_DP: 48, TOOLAPP_BACK_EDGE_WIDTH_DP: 24,
ENABLE_TOOLAPP_INNER_BACK_STRIPS: true, ENABLE_TOOLAPP_INNER_BACK_STRIPS: false,
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: false, ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: true,
TOOLAPP_BACK_COMMIT_DISTANCE_DP: 72, TOOLAPP_BACK_COMMIT_DISTANCE_DP: 72,
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 180, TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 180,
ENABLE_BOUNCE: true, ENABLE_BOUNCE: true,
@@ -850,7 +850,7 @@ var ConfigManager = {
{ type: "section", name: "触摸与手势" }, { type: "section", name: "触摸与手势" },
{ key: "CLICK_SLOP_DP", name: "点击位移阈值(dp)", type: "int", min: 1, max: 40, step: 1 }, { key: "CLICK_SLOP_DP", name: "点击位移阈值(dp)", type: "int", min: 1, max: 40, step: 1 },
{ key: "TOOLAPP_BACK_EDGE_WIDTH_DP", name: "页面内返回边界宽度", type: "int", min: 1, max: 120, step: 1 }, { key: "TOOLAPP_BACK_EDGE_WIDTH_DP", name: "返回热区宽度", type: "int", min: 1, max: 120, step: 1 },
{ key: "ENABLE_TOOLAPP_INNER_BACK_STRIPS", name: "启用页面内左右滑动返回", type: "bool" }, { key: "ENABLE_TOOLAPP_INNER_BACK_STRIPS", name: "启用页面内左右滑动返回", type: "bool" },
{ key: "ENABLE_TOOLAPP_SCREEN_BACK_STRIPS", name: "启用屏幕边缘返回热区(排查用)", type: "bool" }, { key: "ENABLE_TOOLAPP_SCREEN_BACK_STRIPS", name: "启用屏幕边缘返回热区(排查用)", type: "bool" },
{ key: "TOOLAPP_BACK_COMMIT_DISTANCE_DP", name: "设置页返回触发距离", type: "int", min: 1, max: 480, step: 1 }, { key: "TOOLAPP_BACK_COMMIT_DISTANCE_DP", name: "设置页返回触发距离", type: "int", min: 1, max: 480, step: 1 },

View File

@@ -327,20 +327,18 @@ FloatBallAppWM.prototype.applyImmediateEffectsForKey = function(k) {
} else if (this.showToolApp) { } else if (this.showToolApp) {
this.showToolApp(this.state.toolAppRoute || "settings", false); this.showToolApp(this.state.toolAppRoute || "settings", false);
} }
if (this.refreshToolAppScreenBackStrips) this.refreshToolAppScreenBackStrips();
} }
} catch(eBackStrip) { } catch(eBackStrip) {
safeLog(this.L, "w", "apply inner back strip fail: " + String(eBackStrip)); safeLog(this.L, "w", "apply back strip fail: " + String(eBackStrip));
} }
return; return;
} }
if (k === "ENABLE_TOOLAPP_SCREEN_BACK_STRIPS") { if (k === "ENABLE_TOOLAPP_SCREEN_BACK_STRIPS") {
try { try {
if (this.state.toolAppActive) { if (this.state.toolAppActive && this.refreshToolAppScreenBackStrips) {
var enableScreenBackStrip = false; this.refreshToolAppScreenBackStrips();
try { enableScreenBackStrip = parseBooleanLike(this.config.ENABLE_TOOLAPP_SCREEN_BACK_STRIPS); } catch(eCfg2) { enableScreenBackStrip = false; }
if (enableScreenBackStrip && this.hasToolAppBackTarget && this.hasToolAppBackTarget() && this.showToolAppScreenBackStrips) this.showToolAppScreenBackStrips();
else if (this.hideToolAppScreenBackStrips) this.hideToolAppScreenBackStrips();
} }
} catch(eScreenBackStrip) { } catch(eScreenBackStrip) {
safeLog(this.L, "w", "apply screen back strip fail: " + String(eScreenBackStrip)); safeLog(this.L, "w", "apply screen back strip fail: " + String(eScreenBackStrip));

View File

@@ -971,6 +971,10 @@ FloatBallAppWM.prototype.onScreenChangedReflow = function(reason) {
try { this.state.wm.updateViewLayout(this.state.ballRoot, this.state.ballLp); } catch(eU) { safeLog(null, 'e', "catch " + String(eU)); } try { this.state.wm.updateViewLayout(this.state.ballRoot, this.state.ballLp); } catch(eU) { safeLog(null, 'e', "catch " + String(eU)); }
this.savePos(this.state.ballLp.x, this.state.ballLp.y); this.savePos(this.state.ballLp.x, this.state.ballLp.y);
if (this.state.toolAppActive && this.refreshToolAppScreenBackStrips) {
try { this.refreshToolAppScreenBackStrips(); } catch(eBackStrip) { safeLog(this.L, 'w', "screen reflow refresh tool app back strips fail: " + String(eBackStrip)); }
}
safeLog(this.L, 'i', safeLog(this.L, 'i',
"screen reflow reason=" + String(reason || "") + "screen reflow reason=" + String(reason || "") +
" old=" + oldW + "x" + oldH + " old=" + oldW + "x" + oldH +

View File

@@ -914,18 +914,24 @@ FloatBallAppWM.prototype.hideToolAppScreenBackStrips = function() {
}; };
FloatBallAppWM.prototype.getToolAppBackEdgeWidthPx = function() { FloatBallAppWM.prototype.getToolAppBackEdgeWidthPx = function() {
var stripDp = 48; var stripDp = 24;
try { try {
stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 48); stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 24);
if (isNaN(stripDp)) stripDp = 48; if (isNaN(stripDp)) stripDp = 24;
if (stripDp < 1) stripDp = 1; if (stripDp < 1) stripDp = 1;
if (stripDp > 120) stripDp = 120; if (stripDp > 120) stripDp = 120;
} catch(e) { } catch(e) {
stripDp = 48; stripDp = 24;
} }
return this.dp(stripDp); return this.dp(stripDp);
}; };
FloatBallAppWM.prototype.isToolAppScreenBackStripsEnabled = function() {
try { return parseBooleanLike(this.config.ENABLE_TOOLAPP_SCREEN_BACK_STRIPS); } catch(e) {}
try { return String(this.config.ENABLE_TOOLAPP_SCREEN_BACK_STRIPS || "false") === "true"; } catch(e2) {}
return false;
};
FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() { FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() {
try { try {
if (!this.state.wm || !this.state.toolAppActive) return false; if (!this.state.wm || !this.state.toolAppActive) return false;
@@ -933,15 +939,14 @@ FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() {
this.hideToolAppScreenBackStrips(); this.hideToolAppScreenBackStrips();
return false; return false;
} }
if (this.state.toolAppScreenBackStrips && this.state.toolAppScreenBackStrips.length === 2) return true;
this.hideToolAppScreenBackStrips(); this.hideToolAppScreenBackStrips();
var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0)); var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0));
if (sw <= 1) { if (sw <= 1) {
try { var ss = this.getScreenSizePx(); sw = ss.w; } catch (eScreen) {} try { var ss = this.getScreenSizePx(); sw = ss.w; } catch (eScreen) {}
} }
var stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 22); var stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 24);
if (isNaN(stripDp)) stripDp = 22; if (isNaN(stripDp)) stripDp = 24;
if (stripDp < 1) stripDp = 1; if (stripDp < 1) stripDp = 1;
if (stripDp > 120) stripDp = 120; if (stripDp > 120) stripDp = 120;
var stripW = this.dp(stripDp); var stripW = this.dp(stripDp);
@@ -983,6 +988,20 @@ FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() {
return false; return false;
}; };
FloatBallAppWM.prototype.refreshToolAppScreenBackStrips = function() {
try {
this.hideToolAppScreenBackStrips();
if (!this.state.toolAppActive) return false;
if (!this.hasToolAppBackTarget || !this.hasToolAppBackTarget()) return false;
if (!this.isToolAppScreenBackStripsEnabled || !this.isToolAppScreenBackStripsEnabled()) return false;
return this.showToolAppScreenBackStrips();
} catch(e) {
try { this.hideToolAppScreenBackStrips(); } catch(eHide) {}
safeLog(this.L, 'w', "refresh tool app screen back strips fail: " + String(e));
}
return false;
};
FloatBallAppWM.prototype.getToolAppResponsiveSpec = function() { FloatBallAppWM.prototype.getToolAppResponsiveSpec = function() {
var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0)); var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0));
var sh = Math.max(1, Number(this.state.screen && this.state.screen.h || 0)); var sh = Math.max(1, Number(this.state.screen && this.state.screen.h || 0));
@@ -1088,11 +1107,11 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
hostLp.setMargins((spec && (spec.isExpandedWidth || spec.isWideWidth)) ? this.dp(4) : this.dp(6), 0, (spec && (spec.isExpandedWidth || spec.isWideWidth)) ? this.dp(4) : this.dp(6), (spec && (spec.isExpandedWidth || spec.isWideWidth)) ? this.dp(4) : this.dp(6)); hostLp.setMargins((spec && (spec.isExpandedWidth || spec.isWideWidth)) ? this.dp(4) : this.dp(6), 0, (spec && (spec.isExpandedWidth || spec.isWideWidth)) ? this.dp(4) : this.dp(6), (spec && (spec.isExpandedWidth || spec.isWideWidth)) ? this.dp(4) : this.dp(6));
body.addView(host, hostLp); body.addView(host, hostLp);
// 自定义边缘返回热区会覆盖左右边缘的真实按钮(返回、关闭、添加、保存装扮等) // 页面内透明返回热区可能覆盖内容区左右边缘的真实按钮/列表项/颜色面板
// 默认不再叠加透明触摸层;需要排查预测返回时再显式开启 // 默认关闭页面内热区;默认启用更窄的屏幕边缘热区,更贴近全面屏返回习惯
try { try {
var enableInnerBackStrip = false; var enableInnerBackStrip = false;
try { enableInnerBackStrip = (String(this.config.ENABLE_TOOLAPP_INNER_BACK_STRIPS || "false") === "true"); } catch(eCfg) { enableInnerBackStrip = false; } try { enableInnerBackStrip = parseBooleanLike(this.config.ENABLE_TOOLAPP_INNER_BACK_STRIPS); } catch(eCfg) { enableInnerBackStrip = false; }
if (enableInnerBackStrip) { if (enableInnerBackStrip) {
var stripW = this.getToolAppBackEdgeWidthPx ? this.getToolAppBackEdgeWidthPx() : this.dp(24); var stripW = this.getToolAppBackEdgeWidthPx ? this.getToolAppBackEdgeWidthPx() : this.dp(24);
var leftStrip = this.createToolAppEdgeBackStrip(0); var leftStrip = this.createToolAppEdgeBackStrip(0);
@@ -1286,14 +1305,7 @@ FloatBallAppWM.prototype.showToolApp = function(route, resetStack) {
} catch (eUpd) { safeLog(this.L, 'w', "tool_app update layout fail: " + String(eUpd)); } } catch (eUpd) { safeLog(this.L, 'w', "tool_app update layout fail: " + String(eUpd)); }
try { shell.requestFocus(); } catch (eFocus) {} try { shell.requestFocus(); } catch (eFocus) {}
} }
// 不再默认添加屏幕边缘透明覆盖层:它会抢占 ToolApp 顶栏/内容区左右边缘按钮的触摸。 try { this.refreshToolAppScreenBackStrips(); } catch (eScreenBack) { safeLog(this.L, 'w', "screen edge back strip update fail: " + String(eScreenBack)); }
// 如需临时排查返回手势,可把 ENABLE_TOOLAPP_SCREEN_BACK_STRIPS 设为字符串 "true"。
try {
var enableScreenBackStrip = false;
try { enableScreenBackStrip = (String(this.config.ENABLE_TOOLAPP_SCREEN_BACK_STRIPS || "false") === "true"); } catch(eCfg2) { enableScreenBackStrip = false; }
if (enableScreenBackStrip && this.hasToolAppBackTarget && this.hasToolAppBackTarget()) this.showToolAppScreenBackStrips();
else this.hideToolAppScreenBackStrips();
} catch (eScreenBack) { safeLog(this.L, 'w', "screen edge back strip update fail: " + String(eScreenBack)); }
} catch (e) { } catch (e) {
this.state.toolAppActive = false; this.state.toolAppActive = false;
safeLog(this.L, 'e', "showToolApp fail route=" + r + " err=" + String(e)); safeLog(this.L, 'e', "showToolApp fail route=" + r + " err=" + String(e));

View File

@@ -2,8 +2,8 @@
"alg": "SHA256withRSA", "alg": "SHA256withRSA",
"files": { "files": {
"th_01_base.js": { "th_01_base.js": {
"sha256": "d3f390f25d56473584a85f10e10e7df49320674c757fda0b2e9036403e627887", "sha256": "f8651c6ec22e7d06bb3ef2097ee8909523b149afbf5d8b34f9b5c79d8507598a",
"size": 57159 "size": 57150
}, },
"th_02_core.js": { "th_02_core.js": {
"sha256": "3c5c498d200e961d48fc9ca3f885475e770ecb32b83ec6a89d23df3f88aed1c9", "sha256": "3c5c498d200e961d48fc9ca3f885475e770ecb32b83ec6a89d23df3f88aed1c9",
@@ -18,8 +18,8 @@
"size": 42568 "size": 42568
}, },
"th_05_persistence.js": { "th_05_persistence.js": {
"sha256": "ec8ee29c7e4fb7521cf4d1928f41c1495a5314f86dc398a5df9206f879700e45", "sha256": "59fc504c04f6ea397faee33567a773fca175379cba812c37b8ae8c626bc34002",
"size": 16147 "size": 15861
}, },
"th_06_icon_parser.js": { "th_06_icon_parser.js": {
"sha256": "25b95a5df634a7ee359f3ab798e4d3154a71c24016f7b4bf8a658096644b2484", "sha256": "25b95a5df634a7ee359f3ab798e4d3154a71c24016f7b4bf8a658096644b2484",
@@ -34,8 +34,8 @@
"size": 7938 "size": 7938
}, },
"th_09_animation.js": { "th_09_animation.js": {
"sha256": "79e81066da481c8d3a306483a313771fc1058031244f445edb2a618f23dfdbc3", "sha256": "f7358773d9d4761038ac0ab65fa1f370d4577b4f5c8999d022a50ddd60f28418",
"size": 40746 "size": 40993
}, },
"th_10_shell.js": { "th_10_shell.js": {
"sha256": "0ed793079c2f6ba7d29f4c0d411705cb72419f45f572cbe37ed32ac16527a8bc", "sha256": "0ed793079c2f6ba7d29f4c0d411705cb72419f45f572cbe37ed32ac16527a8bc",
@@ -58,8 +58,8 @@
"size": 304993 "size": 304993
}, },
"th_15_extra.js": { "th_15_extra.js": {
"sha256": "11294f672edc0cf85cc662211d73a234301c252f2fa062e8c4b52a2cd3fd8c74", "sha256": "3b89dc66125a7ced5c4a9db43e4b2098ff0f75c7901783299989fb965bf49092",
"size": 106043 "size": 106239
}, },
"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": 20260521213941 "version": 20260521215143
} }

View File

@@ -1 +1 @@
O+tmvZac6NX45Eauc3MsOM3bRjUtRcNh27na7k74S/LPjbT9fZn9vwZQQR7x+DUoSfGfcoN34+jca4HmqvpdWxgQewIiRu0MaGrUxxqkTHCmzto4xX+c9m0DvbY7PBFTXzWInEyKjomoct9DEyXLWQHR+Vq4qWV2Rbh8icDzALLMbqX0VFUeiddPOy36AeC4T5TuLL0RPkYjkWOGdh72SadxgPynoXtD9NyoLZZixUza8nABBFWlKVRbFQ61FVrBtIo1sIdTJqExR22GumXnlFMdZFUaae3g8iGhFbnn62QFx69Dsn8NAJI9/Xu6ER7uryhTL653ZsmFAFoEq7kFAyTQJOv2DvMEMim9mn5v1MaPJhy1KwWhzrt0X2plWoX5Rbq/yJZZkGEhSsgdXowyE3auYe3mnsBpwuLN4XoNaAQNYB7WuhIQb2SGoGa/aP3Q3bojfzdY848v7T6AJedCqcwZQlcLnWTza/Nv6CHCvplk++XlZhzzX5IbXONzvtND ki6nmRhwoltwi9Sf1YkxhFONhxIWJOFcI8E+ccQBq43IEspPEqloDva7Tf0cjiJnx5Gng2mMAIWY+2hlxqd//W5ck/HAkadwqtH+f444U7UW54RTa/NqJ8xD5CfLmmJCdD4kU8qy9+X41qASGqp4sKrW4aToUDGbYWQi/arznv/D7C660v1j5IQAGMnWrOtGEq5ZukMg4emVSXeb8b6ULeBxScQnp52WP6TzHClaHQIeoa59M2/PTRmcpsWhA6yx6xjieF9oo4C6YTLAha3BnIE8cH4xa/eM1LbqtO/U9+/2qOgGpChW2XmEg9V0LxpQ6tE4wuYlYe2+pqBCk3CZxo0gx0j11vJBA1HAEv3h3fqzXsixoPTl/XCu5LlhqeNN3/7AY6d2h2lHBSSkud0XEVtJ3uznbqr00zoZ7otbf7Ns7kmBTkb9JB5OXdbDPxd0bFZmCBYKUb1vAZTYp7yVR8RpzQwAlkARoJd+d03iYjFeuvPViL8xmshjw2NRtsaR