fix: disable legacy ToolApp back strips

This commit is contained in:
7015725
2026-05-22 12:55:46 +08:00
parent a9db5faf1b
commit 7bc4a1bb7d
4 changed files with 15 additions and 59 deletions

View File

@@ -103,7 +103,7 @@ var ConfigValidator = {
TOOLAPP_BACK_GESTURE_MODE: { type: "enum", values: ["edge", "surface", "off"], default: "surface" },
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 72 },
ENABLE_TOOLAPP_INNER_BACK_STRIPS: { type: "bool", default: false },
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: { type: "bool", default: true },
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: { type: "bool", default: false },
TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 1, max: 480, default: 36 },
TOOLAPP_BACK_SURFACE_SLOP_DP: { type: "int", min: 8, max: 96, default: 24 },
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 96 },
@@ -741,7 +741,7 @@ var ConfigManager = {
TOOLAPP_BACK_GESTURE_MODE: "surface",
TOOLAPP_BACK_EDGE_WIDTH_DP: 72,
ENABLE_TOOLAPP_INNER_BACK_STRIPS: false,
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: true,
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: false,
TOOLAPP_BACK_COMMIT_DISTANCE_DP: 36,
TOOLAPP_BACK_SURFACE_SLOP_DP: 24,
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 96,
@@ -861,7 +861,7 @@ var ConfigManager = {
]},
{ 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_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_SURFACE_SLOP_DP", name: "表面横滑起手阈值", type: "int", min: 8, max: 96, step: 1 },
{ key: "TOOLAPP_BACK_PROGRESS_DISTANCE_DP", name: "设置页返回动画距离", type: "int", min: 1, max: 720, step: 1 },

View File

@@ -1210,59 +1210,15 @@ FloatBallAppWM.prototype.getToolAppBackEdgeWidthPx = function() {
};
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 || "true") === "true"; } catch(e2) {}
return true;
// 旧版 WindowManager 透明边缘热区已禁用:它可能抢 ACTION_DOWN影响按钮、列表、SeekBar、Switch。
// 保留函数和清理路径仅为兼容历史状态;正式返回手势由 ToolApp root surface 接管。
try { this.hideToolAppScreenBackStrips(); } catch(eHide) {}
return false;
};
FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() {
// 只在 ToolApp 面板左右的屏幕空白区创建触摸层;绝不覆盖 ToolApp 矩形内部控件区域
try {
this.hideToolAppScreenBackStrips();
if (!this.state || !this.state.wm || !this.state.viewerPanelLp) return false;
var lp0 = this.state.viewerPanelLp;
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));
if (sw <= 1 || sh <= 1) {
try { var ss = this.getScreenSizePx(); sw = ss.w; sh = ss.h; } catch(eScreen) {}
}
var px = Number(lp0.x || 0);
var pw = Number(lp0.width || 0);
if (isNaN(px)) px = 0;
if (isNaN(pw) || pw <= 0) return false;
var minBlank = this.dp(3);
var leftW = Math.max(0, Math.floor(px));
var rightX = Math.floor(px + pw);
var rightW = Math.max(0, Math.floor(sw - rightX));
var made = false;
var arr = [];
var addBlankStrip = function(self, edge, x, w) {
if (!w || w < minBlank) return false;
var strip = self.createToolAppEdgeBackStrip(edge);
var flags = android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
var lp = new android.view.WindowManager.LayoutParams(
w,
sh,
android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
flags,
android.graphics.PixelFormat.TRANSLUCENT
);
lp.gravity = android.view.Gravity.TOP | android.view.Gravity.START;
lp.x = x;
lp.y = 0;
try { self.state.wm.addView(strip, lp); arr.push(strip); return true; } catch(eAdd) { safeLog(self.L, 'w', 'add blank screen back strip fail edge=' + String(edge) + ' err=' + String(eAdd)); }
return false;
};
if (addBlankStrip(this, 0, 0, leftW)) made = true;
if (addBlankStrip(this, 1, rightX, rightW)) made = true;
this.state.toolAppScreenBackStrips = arr;
try { if (made) safeLog(this.L, 'd', 'blank screen back strips leftW=' + String(leftW) + ' rightW=' + String(rightW) + ' panelX=' + String(px) + ' panelW=' + String(pw)); } catch(eLog) {}
return made;
} catch(e) {
try { this.hideToolAppScreenBackStrips(); } catch(eHide2) {}
safeLog(this.L, 'w', "show blank screen back strips fail: " + String(e));
}
// 旧版 WindowManager 透明边缘热区已禁用;不要再创建额外触摸层
try { this.hideToolAppScreenBackStrips(); } catch(eHide) {}
return false;
};