ADFA-4471 | Fix SwipeRevealLayout intercepting editor scroll gestures#1457
ADFA-4471 | Fix SwipeRevealLayout intercepting editor scroll gestures#1457jatezzz wants to merge 1 commit into
Conversation
Prevents the layout from stealing scroll gestures that originate within the overlapping editor content.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
📝 Walkthrough
WalkthroughSwipeRevealLayout now tracks whether the latest ChangesSwipe-reveal handle gating
Sequence Diagram(s)sequenceDiagram
participant MotionEvent
participant SwipeRevealLayout
participant editor_appBarLayout
participant dragHelperCallback
MotionEvent->>SwipeRevealLayout: ACTION_DOWN
SwipeRevealLayout->>editor_appBarLayout: getLocationOnScreen()
SwipeRevealLayout->>SwipeRevealLayout: isTouchInDragHandle()
SwipeRevealLayout->>dragHelperCallback: tryCaptureView()
dragHelperCallback->>SwipeRevealLayout: allow capture only when vertical drag is enabled and the touch-down was inside the handle
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.kt (1)
71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMisplaced KDoc — it documents
isDownInDragHandlebut is attached todragHandleLocation.The doc block sits between the two property declarations, so it binds to
dragHandleLocationwhile its text describesisDownInDragHandle. Move it aboveisDownInDragHandle.♻️ Proposed fix
- private var isDownInDragHandle = false - /** - * Whether the most recent touch-down landed within the configured drag handle. The vertical - * drag-to-reveal gesture is only captured when this is `true`, so that scroll gestures starting - * in the middle of the overlapping content (e.g. the editor) are not stolen. - */ - private val dragHandleLocation = IntArray(2) + /** + * Whether the most recent touch-down landed within the configured drag handle. The vertical + * drag-to-reveal gesture is only captured when this is `true`, so that scroll gestures starting + * in the middle of the overlapping content (e.g. the editor) are not stolen. + */ + private var isDownInDragHandle = false + + private val dragHandleLocation = IntArray(2)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.kt` around lines 71 - 77, The KDoc currently attaches to dragHandleLocation even though it describes isDownInDragHandle; move the documentation block so it directly precedes isDownInDragHandle in SwipeRevealLayout, keeping dragHandleLocation undocumented or adding a separate comment if needed. Ensure the property order and comment placement match the intent of the drag-reveal gesture state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.kt`:
- Around line 71-77: The KDoc currently attaches to dragHandleLocation even
though it describes isDownInDragHandle; move the documentation block so it
directly precedes isDownInDragHandle in SwipeRevealLayout, keeping
dragHandleLocation undocumented or adding a separate comment if needed. Ensure
the property order and comment placement match the intent of the drag-reveal
gesture state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 07486f25-4602-4f6a-a023-e5706bd51641
📒 Files selected for processing (2)
app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.ktapp/src/main/res/layout/activity_editor.xml
Description
Fixed an issue where
SwipeRevealLayoutwould inadvertently steal vertical scroll gestures from the overlapping editor content. The vertical drag-to-reveal gesture is now strictly captured only if the initial touch-down event lands within the bounds of the configured drag handle. Furthermore, the drag handle in the editor layout was updated to map to theeditor_appBarLayout.Details
isTouchInDragHandle) onACTION_DOWNto verify the gesture's origin.activity_editor.xmlto pointapp:dragHandleto@id/editor_appBarLayoutinstead of the project actions toolbar.obtainStyledAttributesto use the more idiomaticwithStyledAttributesextension from AndroidX Core.document_5042282667677059376.mp4
Ticket
ADFA-4471
Observation
The logic preserves legacy behavior: if a
SwipeRevealLayoutinstance has adragHandleViewIdof0(no handle configured), the entire overlapping content will continue to act as the handle.