6.7.0 - Alpha13 - 修复部分设备无法正常触发文件管理器功能按钮点击事件的问题 (试修) (issue #465)

This commit is contained in:
SuperMonster003
2025-12-30 00:09:27 +08:00
parent 517872f620
commit be2860b90b
4 changed files with 61 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
{
"$data": {
"v6.7.0": {
"released_date": "2025/12/26",
"released_date": "2025/12/30",
"feature": [
"插件中心功能, 支持插件的安装/卸载/更新等操作 (入口: 主页抽屉按钮)",
"cvt 模块, 用于数据单位转换 (参阅 项目文档 > [单位转换](https://docs.autojs6.com/#/cvt))",
@@ -66,6 +66,7 @@
"打包应用无法正常使用 Paddle OCR 与 Rapid OCR 功能的问题",
"版本历史页面部分系统因字体差别导致统计数据显示不完整的问题",
"部分设备无法正常初始化 MLKit Google OCR 的问题 (试修) _[`issue #8`](http://issues.autojs6.com/8#issuecomment-3117061768)_",
"部分设备无法正常触发文件管理器功能按钮点击事件的问题 (试修) _[`issue #465`](http://issues.autojs6.com/465)_",
"ErrorDialogActivity 可能无法正常启动或短时间自动消失的问题 _[`issue #471`](http://issues.autojs6.com/471)_ _[`issue #414`](http://issues.autojs6.com/414)_ _[`issue #340`](http://issues.autojs6.com/340#issuecomment-2973485826)_",
"崩溃报告页面复制详细信息功能失效的问题",
"文件管理器删除项目文件夹后 UI 未能自动刷新的问题",

View File

@@ -25,6 +25,7 @@ import org.autojs.autojs6.R;
/**
* Created by Stardust on Sep 24, 2017.
* Modified by SuperMonster003 as of Dec 29, 2025.
*/
public class FloatingActionMenu extends FrameLayout implements View.OnClickListener {
@@ -52,6 +53,8 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
private boolean mExpanded = false;
private OnFloatingActionButtonClickListener mOnFloatingActionButtonClickListener;
private View mToggleFab;
public FloatingActionMenu(@NonNull Context context) {
super(context);
init();
@@ -107,6 +110,10 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
mOnFloatingActionButtonClickListener = listener;
}
public void setToggleFab(@Nullable View toggleFab) {
mToggleFab = toggleFab;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
@@ -184,18 +191,61 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
mOverlay = new View(context) {
private final int[] loc = new int[2];
private final Rect menuRect = new Rect();
private final Rect menuRectOnScreen = new Rect();
private final Rect toggleFabRectOnScreen = new Rect();
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
thisMenu.getLocationOnScreen(loc);
menuRect.set(loc[0], loc[1], loc[0] + thisMenu.getWidth(), loc[1] + thisMenu.getHeight());
if (!isInMenuButtonsArea(menuRect, event)) {
var replay = MotionEvent.obtain(event);
root.post(() -> activity.getWindow().getDecorView().dispatchTouchEvent(replay));
menuRectOnScreen.set(
loc[0],
loc[1],
loc[0] + thisMenu.getWidth(),
loc[1] + thisMenu.getHeight()
);
boolean hasToggleFab = (mToggleFab != null) && mToggleFab.isShown();
if (hasToggleFab) {
mToggleFab.getLocationOnScreen(loc);
toggleFabRectOnScreen.set(
loc[0],
loc[1],
loc[0] + mToggleFab.getWidth(),
loc[1] + mToggleFab.getHeight()
);
} else {
toggleFabRectOnScreen.setEmpty();
}
int rawX = (int) event.getRawX();
int rawY = (int) event.getRawY();
boolean inToggleFab = hasToggleFab && toggleFabRectOnScreen.contains(rawX, rawY);
if (inToggleFab) {
MotionEvent forwarded = MotionEvent.obtain(event);
forwarded.offsetLocation(-toggleFabRectOnScreen.left, -toggleFabRectOnScreen.top);
mToggleFab.dispatchTouchEvent(forwarded);
forwarded.recycle();
return true;
}
boolean inMenu = menuRectOnScreen.contains(rawX, rawY);
if (inMenu) {
MotionEvent forwarded = MotionEvent.obtain(event);
forwarded.offsetLocation(-menuRectOnScreen.left, -menuRectOnScreen.top);
thisMenu.dispatchTouchEvent(forwarded);
forwarded.recycle();
return true;
}
// Collapse for external touches, avoid breaking button click chains.
// zh-CN: 对外部触摸进行收起, 避免破坏按钮点击链路.
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
collapse();
}
// Do not consume external events, pass them to lower layers such as lists for continued processing.
// zh-CN: 不消耗外部事件, 交给下层列表等继续处理.
return false;
}
};
@@ -207,10 +257,6 @@ public class FloatingActionMenu extends FrameLayout implements View.OnClickListe
root.addView(mOverlay);
}
private boolean isInMenuButtonsArea(Rect menuRect, MotionEvent event) {
return menuRect.contains((int) event.getRawX(), (int) event.getRawY());
}
private void hideOverlay() {
if (mOverlay != null) mOverlay.setVisibility(View.GONE);
}

View File

@@ -138,6 +138,7 @@ class ExplorerFragment : ViewPagerFragment(0), OnFloatingActionButtonClickListen
menu.layoutParams.runCatching {
javaClass.getField("bottomMargin").setInt(this, fab.marginBottom)
}
menu.setToggleFab(fab)
mFloatingActionMenu = menu
}
}

View File

@@ -1,5 +1,5 @@
#Mon Dec 29 19:40:59 CST 2025
BUILD_TIME=1767008459948
#Tue Dec 30 00:06:17 CST 2025
BUILD_TIME=1767024377057
COMPILE_SDK_VERSION=36
IMAGE_QUANT_CMAKE_VERSION=3.22.1
IMAGE_QUANT_NDK_VERSION=26.1.10909125
@@ -27,6 +27,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=36
TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3562
VERSION_BUILD=3563
VERSION_NAME=6.7.0 Alpha13
VSCODE_EXT_REQUIRED_VERSION=1.0.8