Skip to content

ADFA-4471 | Fix SwipeRevealLayout intercepting editor scroll gestures#1457

Open
jatezzz wants to merge 1 commit into
stagefrom
fix/ADFA-4471-swipe-reveal-drag-intercept
Open

ADFA-4471 | Fix SwipeRevealLayout intercepting editor scroll gestures#1457
jatezzz wants to merge 1 commit into
stagefrom
fix/ADFA-4471-swipe-reveal-drag-intercept

Conversation

@jatezzz

@jatezzz jatezzz commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixed an issue where SwipeRevealLayout would 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 the editor_appBarLayout.

Details

  • Added a touch bounds-check (isTouchInDragHandle) on ACTION_DOWN to verify the gesture's origin.
  • Updated activity_editor.xml to point app:dragHandle to @id/editor_appBarLayout instead of the project actions toolbar.
  • Refactored obtainStyledAttributes to use the more idiomatic withStyledAttributes extension from AndroidX Core.
document_5042282667677059376.mp4

Ticket

ADFA-4471

Observation

The logic preserves legacy behavior: if a SwipeRevealLayout instance has a dragHandleViewId of 0 (no handle configured), the entire overlapping content will continue to act as the handle.

Prevents the layout from stealing scroll gestures that originate within the overlapping editor content.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough
  • Fixed SwipeRevealLayout so drag-to-reveal only starts when the initial touch-down is inside the configured drag handle, preventing it from intercepting vertical scroll gestures from overlapping editor content.
  • Kept existing behavior when no drag handle is configured (dragHandleViewId == 0), where the full overlapping content still acts as the handle.
  • Updated the editor layout to use @id/editor_appBarLayout as the swipe drag handle instead of @id/project_actions_toolbar.
  • Refactored styled attribute loading to use AndroidX Core’s withStyledAttributes extension instead of manual obtainStyledAttributes/recycle handling.
  • Risk: changing the drag handle target may affect swipe discoverability or interaction behavior for users relying on the previous toolbar area.

Walkthrough

SwipeRevealLayout now tracks whether the latest ACTION_DOWN landed inside its configured drag handle before allowing vertical drag capture. The handle attribute is read with withStyledAttributes, and activity_editor.xml now points the handle at editor_appBarLayout.

Changes

Swipe-reveal handle gating

Layer / File(s) Summary
Handle-based capture gating
app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.kt
SwipeRevealLayout now reads dragHandleViewId with withStyledAttributes, tracks whether ACTION_DOWN landed inside the drag handle, and only allows vertical capture when that state is true.
Editor handle wiring
app/src/main/res/layout/activity_editor.xml
SwipeRevealLayout in the editor layout now uses editor_appBarLayout as its app:dragHandle target.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • appdevforall/CodeOnTheGo#755 — Also updates the app:dragHandle target used by SwipeRevealLayout, so the handle-based capture logic here is closely tied to that wiring.
  • appdevforall/CodeOnTheGo#1388 — Also changes SwipeRevealLayout vertical drag behavior and the conditions under which it can capture.

Suggested reviewers

  • itsaky-adfa
  • Daniel-ADFA

Poem

A bunny tapped the app bar with a paw,
Then hopped away if the touch fell short of the draw.
Inside the handle, the panel starts to glide,
SwipeRevealLayout keeps the opening tied.
🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing SwipeRevealLayout from intercepting editor scroll gestures.
Description check ✅ Passed The description accurately describes the implemented fix, layout update, and styled-attribute refactor.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ADFA-4471-swipe-reveal-drag-intercept

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.kt (1)

71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Misplaced KDoc — it documents isDownInDragHandle but is attached to dragHandleLocation.

The doc block sits between the two property declarations, so it binds to dragHandleLocation while its text describes isDownInDragHandle. Move it above isDownInDragHandle.

♻️ 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

📥 Commits

Reviewing files that changed from the base of the PR and between c14733b and d6dc508.

📒 Files selected for processing (2)
  • app/src/main/java/com/itsaky/androidide/ui/SwipeRevealLayout.kt
  • app/src/main/res/layout/activity_editor.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants