Add LongPressMove display mode with floating window movement priority#231
Add LongPressMove display mode with floating window movement priority#231
Conversation
Co-authored-by: Petterpx <41142188+Petterpx@users.noreply.github.com>
|
@copilot 同时需要考虑浮窗子view设置点击事件后的处理 |
Co-authored-by: Petterpx <41142188+Petterpx@users.noreply.github.com>
已经优化了LongPressMove模式来正确处理浮窗子视图的点击事件。现在的逻辑是:
这样既解决了内容滑动冲突,又保证了子视图点击事件的即时响应。实现使用了Android的 在测试Demo中添加了相关示例:
commit: 15db378 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot 你理解错了,我的意思如果用户的浮窗子view设置了点击事件,此时处于LongPressMove时,应该优先浮窗本身拦截所有事件,而不是仅长按浮窗没有点击事件的地方才支持移动。你上次的更改可以先撤销掉,然后重新处理。 |
…ogic Co-authored-by: Petterpx <41142188+Petterpx@users.noreply.github.com>
已经按您的要求重新处理了LongPressMove模式的逻辑。现在的实现是:
这样确保了当浮窗包含设置了点击事件的子视图时,浮窗本身的移动功能优先级更高,避免了触摸事件冲突。 移除了之前的智能检测逻辑,改为在初始化时全局检查是否有子视图设置了点击事件( commit: d98b3fc Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR adds a new
LongPressMovedisplay mode to FloatingX that prioritizes floating window movement when child views have click events, resolving touch event conflicts in interactive floating windows.Problem
When a floating window contains interactive content (buttons, clickable views), users experience conflicts between:
Currently, users must choose between:
Normalmode: Can move window but child interactions conflict with movementClickOnlymode: Child content works but window cannot be movedDisplayOnlymode: No interactions at allSolution
The new
LongPressMovemode provides intelligent priority handling:Priority-Based Touch Handling
Real-world Examples
Implementation Details
Core Changes
FxDisplayMode.kt:
LongPressMoveenum value withcanLongPressMovepropertyFxViewTouchHelper.kt:
checkIfChildHasClickEvents()Enhanced Demo Examples
ScopeActivity:
SimpleRvActivity:
Backward Compatibility
This is a purely additive enhancement:
Display Mode Comparison
The priority-based system eliminates touch conflicts by clearly defining interaction hierarchy - when child views have click events, the floating window movement takes precedence.
Fixes #222.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.