fix: capture screen edge back for ToolApp

This commit is contained in:
7015725
2026-05-14 03:10:25 +08:00
parent f8463490e1
commit a8cd7c193d
5 changed files with 77 additions and 8 deletions

View File

@@ -56,6 +56,7 @@ function FloatBallAppWM(logger) {
toolAppBackPreviewView: null,
toolAppBackPreviewRoute: null,
toolAppBackPreviewReady: false,
toolAppScreenBackStrips: [],
toolAppTitleView: null,
toolAppBackButton: null,
settingsGroupKey: null,

View File

@@ -128,6 +128,7 @@ FloatBallAppWM.prototype.safeRemoveView = function(v, whichName) {
try {
if (!v) return { ok: true, skipped: true };
try { if (this.unregisterPanelPredictiveBack) this.unregisterPanelPredictiveBack(v); } catch (eBack) {}
try { if (whichName === "viewerPanel" && this.state && String(this.state.viewerPanelType || "") === "tool_app" && this.hideToolAppScreenBackStrips) this.hideToolAppScreenBackStrips(); } catch (eStrip) {}
this.state.wm.removeView(v);
return { ok: true };
} catch (e) {
@@ -195,6 +196,7 @@ FloatBallAppWM.prototype.hideViewerPanel = function() {
this.state.toolAppBackPreviewView = null;
this.state.toolAppBackPreviewRoute = null;
this.state.toolAppBackPreviewReady = false;
try { if (this.hideToolAppScreenBackStrips) this.hideToolAppScreenBackStrips(); } catch (eStrip) {}
this.state.toolAppTitleView = null;
this.state.toolAppBackButton = null;
}
@@ -535,6 +537,7 @@ FloatBallAppWM.prototype._clearHeavyCachesIfAllHidden = function(reason) {
};
FloatBallAppWM.prototype.hideAllPanels = function() {
try { if (this.hideToolAppScreenBackStrips) this.hideToolAppScreenBackStrips(); } catch (eStrip) {}
this.hideMainPanel();
this.hideSettingsPanel();
this.hideViewerPanel();

View File

@@ -520,6 +520,7 @@ FloatBallAppWM.prototype.closeToolApp = function() {
this.state.toolAppBackPreviewView = null;
this.state.toolAppBackPreviewRoute = null;
this.state.toolAppBackPreviewReady = false;
try { if (this.hideToolAppScreenBackStrips) this.hideToolAppScreenBackStrips(); } catch (eStrip) {}
this.state.toolAppTitleView = null;
this.state.toolAppBackButton = null;
} catch (e) { safeLog(this.L, 'e', "closeToolApp fail: " + String(e)); }
@@ -760,6 +761,69 @@ FloatBallAppWM.prototype.createToolAppEdgeBackStrip = function(edge) {
return strip;
};
FloatBallAppWM.prototype.hideToolAppScreenBackStrips = function() {
try {
var arr = this.state.toolAppScreenBackStrips || [];
for (var i = 0; i < arr.length; i++) {
try { if (arr[i] && this.state.wm) this.state.wm.removeView(arr[i]); } catch (eRm) {}
}
this.state.toolAppScreenBackStrips = [];
} catch (e) { safeLog(this.L, 'w', "hide tool app screen back strips fail: " + String(e)); }
};
FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() {
try {
if (!this.state.wm || !this.state.toolAppActive) return false;
if (!this.getToolAppPreviousStackEntry || !this.getToolAppPreviousStackEntry()) {
this.hideToolAppScreenBackStrips();
return false;
}
if (this.state.toolAppScreenBackStrips && this.state.toolAppScreenBackStrips.length === 2) return true;
this.hideToolAppScreenBackStrips();
var sw = Math.max(1, Number(this.state.screen && this.state.screen.w || 0));
if (sw <= 1) {
try { var ss = this.getScreenSizePx(); sw = ss.w; } catch (eScreen) {}
}
var stripW = this.dp(22);
var flags = android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
var left = this.createToolAppEdgeBackStrip(0);
var lpL = new android.view.WindowManager.LayoutParams(
stripW,
android.view.WindowManager.LayoutParams.MATCH_PARENT,
android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
flags,
android.graphics.PixelFormat.TRANSLUCENT
);
lpL.gravity = android.view.Gravity.START | android.view.Gravity.TOP;
lpL.x = 0;
lpL.y = 0;
var right = this.createToolAppEdgeBackStrip(1);
var lpR = new android.view.WindowManager.LayoutParams(
stripW,
android.view.WindowManager.LayoutParams.MATCH_PARENT,
android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
flags,
android.graphics.PixelFormat.TRANSLUCENT
);
lpR.gravity = android.view.Gravity.START | android.view.Gravity.TOP;
lpR.x = Math.max(0, sw - stripW);
lpR.y = 0;
this.state.wm.addView(left, lpL);
this.state.wm.addView(right, lpR);
this.state.toolAppScreenBackStrips = [left, right];
return true;
} catch (e) {
this.hideToolAppScreenBackStrips();
safeLog(this.L, 'w', "show tool app screen back strips fail: " + String(e));
}
return false;
};
FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBack) {
var self = this;
var isDark = this.isDarkTheme();
@@ -973,6 +1037,7 @@ FloatBallAppWM.prototype.showToolApp = function(route, resetStack) {
} catch (eUpd) { safeLog(this.L, 'w', "tool_app update layout fail: " + String(eUpd)); }
try { shell.requestFocus(); } catch (eFocus) {}
}
try { this.showToolAppScreenBackStrips(); } catch (eScreenBack) { safeLog(this.L, 'w', "show screen edge back fail: " + String(eScreenBack)); }
} catch (e) {
this.state.toolAppActive = false;
safeLog(this.L, 'e', "showToolApp fail route=" + r + " err=" + String(e));

View File

@@ -6,8 +6,8 @@
"size": 52546
},
"th_02_core.js": {
"sha256": "c8d823e135a4b58a50336586ab13265e5ff4b72531633908b635b243401f461a",
"size": 4551
"sha256": "15bb9bfbd19a673d442e221b0a00a456ed5f87af2666b9c73b117d6223faeecd",
"size": 4584
},
"th_03_icon.js": {
"sha256": "717f7f37474d3616c2cd944581455f600020a850ec8812100d0546ec1302c987",
@@ -34,8 +34,8 @@
"size": 7938
},
"th_09_animation.js": {
"sha256": "f5f0f87c7bfefd1a434d6cc14c87464c32d5419dc5381e6a771974abcc65a003",
"size": 36270
"sha256": "5f5e8743438af92238c377d864a8ab54ba0f5c1fb9198e4003f2530ee1fb4bf5",
"size": 36684
},
"th_10_shell.js": {
"sha256": "0ed793079c2f6ba7d29f4c0d411705cb72419f45f572cbe37ed32ac16527a8bc",
@@ -58,8 +58,8 @@
"size": 239523
},
"th_15_extra.js": {
"sha256": "2f440db325b0349e86bdfdfcea98c96aa84b1c4457b623d9e4219cd67c9d045a",
"size": 87017
"sha256": "c46b15ddd46fe548813a927f45d525b5b799b209b56c6f05b355ef59c37770e1",
"size": 89681
},
"th_16_entry.js": {
"sha256": "e7c99c3dfbd6aedab05551426955081ae6cae034754f2f557cefa01dc75dc001",
@@ -68,5 +68,5 @@
},
"keyId": "toolhub-targets-2026-rsa3072",
"schema": 2,
"version": 20260513190421
"version": 20260513191013
}

View File

@@ -1 +1 @@
i6ZGfxdczdGE61nAq6GJ0JfrHv/qrzzsQ5vDnHTI2uSAQo9KIClf5UMJmB0UlNZ1UG73OxdxSjFnNgXcGyc2QKKtSBkRNb5bC/49KCFWczaoGidXaGXd28IKjtQu4R+0cw7kS+4GfzN+ucTgBZYu79M4vfs9qsx+dhltSTgeAFzXP4skt7C5sWF6YpDMxuJDNsKQr1EqdssdnVxKQapT03Fpkflp5BBD4O2izkOdXgYKrhPMtRlSjacZn91sw6H2h/XTB4a/ogybxMWrZDv39plIMAdLe4ua/hnifKsjzAR9WnIGAyLOMkQ7lWnt4bspHALBrG2ehahoCqS4DYUZyXAWoePUA/4ZVxQUfi1uxRaQApc/Sbd+RPW7L4gbHIb2xB9aHzNDjQWDrSpIY6b65Y2YgichG1MG21k3yC3N/caggRwtDn6aP/qnZY7ZFJtBbocP4SUdaiaXdOiAdW1nlIrmLWnp47Mg3roEPM97aRMVEnRK55Tit/LCf+gg0+Pf
MDFkuupKMa3WOF6k4FEjEUDpEgxCnwNtCPOyqgB62IWvxKNGLcru5te81MGFNGIyfOKd/eq7CJQ+g18iXdOx618qeMKI6cHpUTVPSOOeLsvRijlJp7/mWip5OG2OPOUziiaMNafBLddQRrRHn0siNoWG5hte3SYfUcVLw8SpJTAwjJCoX56MB6E2tkdkv2Beg+76my7LBd0IK5bAms/cj5v5wDGxnj58iJxIgt5JjpW0TZp3OzMLBjmk4uvUm2rqVeoEIoHwrFN87P9TNZ2K8YoR6DskyRhZAvwZd3RCN92UKK7xu8XqY0YeSYFHdcZe8ntMfvt/vDOe5RMWD1VbU0F6l960aYhZx1wH3eU+nQ/zy920ryRjH/S904q9ZLC+S4QDX4u3xKRTUjQVKh9TBE5ZwnAI3PKDt7W1y/tiOE9X5j8cLtvzSySkvrG1SY+pbfKTdonlVAV6QXOSYZRsJp7Gr8MSVQOhJwVz4HoByOI2EiQSbLwxLexuFUJhIKvN