feat: expand ToolApp back gesture ranges
This commit is contained in:
@@ -99,9 +99,9 @@ var ConfigValidator = {
|
||||
LONG_PRESS_MS: { type: "int", min: 200, max: 2000, default: 600 },
|
||||
LONG_PRESS_VIBRATE_MS: { type: "int", min: 10, max: 100, default: 40 },
|
||||
CLICK_SLOP_DP: { type: "int", min: 2, max: 20, default: 6 },
|
||||
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 12, max: 48, default: 22 },
|
||||
TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 48, max: 160, default: 72 },
|
||||
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 120, max: 320, default: 180 },
|
||||
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 22 },
|
||||
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 },
|
||||
|
||||
// 功能开关
|
||||
ENABLE_SNAP_TO_EDGE: { type: "bool", default: true },
|
||||
@@ -844,9 +844,9 @@ var ConfigManager = {
|
||||
|
||||
{ type: "section", name: "触摸与手势" },
|
||||
{ key: "CLICK_SLOP_DP", name: "点击位移阈值(dp)", type: "int", min: 1, max: 40, step: 1 },
|
||||
{ key: "TOOLAPP_BACK_EDGE_WIDTH_DP", name: "设置页返回边界宽度", type: "int", min: 12, max: 48, step: 1 },
|
||||
{ key: "TOOLAPP_BACK_COMMIT_DISTANCE_DP", name: "设置页返回触发距离", type: "int", min: 48, max: 160, step: 1 },
|
||||
{ key: "TOOLAPP_BACK_PROGRESS_DISTANCE_DP", name: "设置页返回动画距离", type: "int", min: 120, max: 320, step: 1 },
|
||||
{ key: "TOOLAPP_BACK_EDGE_WIDTH_DP", name: "设置页返回边界宽度", type: "int", min: 1, max: 120, step: 1 },
|
||||
{ key: "TOOLAPP_BACK_COMMIT_DISTANCE_DP", name: "设置页返回触发距离", type: "int", min: 1, max: 480, step: 1 },
|
||||
{ key: "TOOLAPP_BACK_PROGRESS_DISTANCE_DP", name: "设置页返回动画距离", type: "int", min: 1, max: 720, step: 1 },
|
||||
{ key: "ENABLE_LONG_PRESS", name: "启用长按", type: "bool" },
|
||||
{ key: "LONG_PRESS_MS", name: "长按判定(ms)", type: "int", min: 200, max: 2000, step: 10 },
|
||||
{ key: "LONG_PRESS_HAPTIC_ENABLE", name: "长按震动反馈", type: "bool" },
|
||||
|
||||
@@ -788,8 +788,8 @@ FloatBallAppWM.prototype.createToolAppEdgeBackStrip = function(edge) {
|
||||
moved = true;
|
||||
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 180);
|
||||
if (isNaN(triggerDp)) triggerDp = 180;
|
||||
if (triggerDp < 120) triggerDp = 120;
|
||||
if (triggerDp > 320) triggerDp = 320;
|
||||
if (triggerDp < 1) triggerDp = 1;
|
||||
if (triggerDp > 720) triggerDp = 720;
|
||||
var triggerDistance = self.dp(triggerDp);
|
||||
var p = Math.min(1, Math.abs(mx) / triggerDistance);
|
||||
self.applyToolAppBackPreviewProgress(edge, p);
|
||||
@@ -801,8 +801,8 @@ FloatBallAppWM.prototype.createToolAppEdgeBackStrip = function(edge) {
|
||||
var uy = event.getRawY() - downY;
|
||||
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 72);
|
||||
if (isNaN(commitDp)) commitDp = 72;
|
||||
if (commitDp < 48) commitDp = 48;
|
||||
if (commitDp > 160) commitDp = 160;
|
||||
if (commitDp < 1) commitDp = 1;
|
||||
if (commitDp > 480) commitDp = 480;
|
||||
var completeDistance = self.dp(commitDp);
|
||||
var okDir = (edge === 0 && ux > completeDistance) || (edge === 1 && ux < -completeDistance);
|
||||
var ok = (action === android.view.MotionEvent.ACTION_UP) && moved && okDir && Math.abs(ux) > Math.abs(uy) * 1.2;
|
||||
@@ -846,8 +846,8 @@ FloatBallAppWM.prototype.showToolAppScreenBackStrips = function() {
|
||||
}
|
||||
var stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 22);
|
||||
if (isNaN(stripDp)) stripDp = 22;
|
||||
if (stripDp < 12) stripDp = 12;
|
||||
if (stripDp > 48) stripDp = 48;
|
||||
if (stripDp < 1) stripDp = 1;
|
||||
if (stripDp > 120) stripDp = 120;
|
||||
var stripW = this.dp(stripDp);
|
||||
var flags = android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
||||
android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
|
||||
|
||||
Reference in New Issue
Block a user