Skip to content

ADFA-3495 | Add swipe-down gesture to reveal top bar#1141

Merged
jatezzz merged 4 commits intostagefrom
feat/ADFA-3495-swipe-down-top-bar
Apr 1, 2026
Merged

ADFA-3495 | Add swipe-down gesture to reveal top bar#1141
jatezzz merged 4 commits intostagefrom
feat/ADFA-3495-swipe-down-top-bar

Conversation

@jatezzz
Copy link
Copy Markdown
Collaborator

@jatezzz jatezzz commented Mar 31, 2026

Description

This PR implements a downward swipe gesture to reveal the immersive top bar in the editor. The showTopBar method in LandscapeImmersiveController was exposed so it could be triggered externally. In BaseEditorActivity, the gesture detector was updated to recognize downward flings originating near the top edge of the screen. This check is intentionally placed before the noFilesOpen validation so users can reveal the top bar while actively editing code. Additionally, the right-swipe logic for the side drawer was refined to prevent diagonal swipes from triggering it accidentally.

Details

DeX

document_5071403752829748783.mp4

Phone (Landscape)

Screen_Recording_20260331_163558_Code.on.the.Go.mp4

Ticket

ADFA-3495

Observation

The noFilesOpen block in the gesture listener was specifically moved below the vertical swipe logic so that the new top bar toggle gesture works seamlessly without requiring the user to close their active editor tabs.

Expose showTopBar and add downward fling detection to gesture listener.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough
  • Features

    • Added swipe-down gesture to reveal the top bar in immersive editor (landscape only)
      • Activates for downward flings starting near the top edge (threshold ≈ TOP_EDGE_SWIPE_THRESHOLD_DP, ~60dp)
      • Gesture handling runs before the "no files open" validation so users can reveal the top bar while editing
    • Preview assets attached for DeX and Phone (Landscape)
  • Improvements

    • Refined right-swipe gesture logic for the side drawer to reduce accidental triggers from diagonal swipes
      • Now requires dominant horizontal motion (abs(diffX) > abs(diffY)) and explicit horizontal distance/velocity checks
    • Refactor: improved gesture detection readability and reusability to support new behaviors
  • API Changes

    • LandscapeImmersiveController.showTopBar(animate: Boolean = true) visibility changed from private → public
      • Exposed for external invocation; signature and default behavior unchanged
  • Risk / Best-practice considerations

    • ⚠️ Gesture priority reordering: The swipe-down check now runs before the no-files-open gate, changing event flow. This may cause unexpected top-bar reveals or interfere with other gestures — test across editor states and orientations.
    • ⚠️ Gesture sensitivity and thresholds: The top-edge origin check (~60dp), displacement and velocity thresholds, and dominant-axis checks may be too strict or too permissive on some devices (DeX, various phones). Validate on target devices and with varied user gestures.
    • ⚠️ Public API exposure: Making showTopBar public creates a new contract; update documentation and consider semantic versioning or noting for consumers.
    • ⚠️ Potential regressions: Changes in onFling() logic could affect other fling-based interactions. Run gesture-related integration and accessibility tests (including external input devices).
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a swipe-down gesture to reveal the top bar in the editor.
Description check ✅ Passed The description clearly explains the changes made, including the exposure of showTopBar method, the gesture detector updates, and refinements to the right-swipe logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/ADFA-3495-swipe-down-top-bar

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt`:
- Around line 1444-1452: The downward fling handler currently calls
immersiveController?.showTopBar() unconditionally; restrict this to landscape by
checking the current orientation or controller type before invoking
landscape-only behavior: inside the fling handling block (where e1, diffY,
diffX, velocityY are used) add a guard such as verifying
resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE or
that immersiveController is an instance of LandscapeImmersiveController, and
only then call immersiveController?.showTopBar(); keep the existing
topEdgeThreshold logic and return true behavior unchanged when the guard passes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05dd849d-beb5-46c8-b039-161bd12f3e4b

📥 Commits

Reviewing files that changed from the base of the PR and between b146bf6 and efc6e72.

📒 Files selected for processing (2)
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/LandscapeImmersiveController.kt

@jatezzz jatezzz requested a review from dara-abijo-adfa April 1, 2026 14:39
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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/activities/editor/BaseEditorActivity.kt (1)

1460-1462: Avoid redundant top-bar animations on repeated downward flings.

At Line 1461, every qualifying fling calls showTopBar(). Since that method always expands/animates, repeated flings can spam expansion animations. Consider routing through an idempotent controller API (e.g., showTopBarIfNeeded) to skip no-op expands.

♻️ Suggested follow-up
- if (isLandscape && startedNearTopEdge && hasDownFlingDistance && hasVerticalVelocity && isVerticalSwipe) {
-     immersiveController?.showTopBar()
+ if (isLandscape && startedNearTopEdge && hasDownFlingDistance && hasVerticalVelocity && isVerticalSwipe) {
+     immersiveController?.showTopBarIfNeeded()
      return true
  }
// In LandscapeImmersiveController.kt
fun showTopBarIfNeeded(animate: Boolean = true) {
    if (isTopBarRequestedVisible) return
    showTopBar(animate)
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt`
around lines 1460 - 1462, The fling handler in BaseEditorActivity currently
calls immersiveController?.showTopBar() unconditionally, causing repeated
expansion animations; update the call to an idempotent API (e.g.,
immersiveController?.showTopBarIfNeeded(animate = true)) and implement
showTopBarIfNeeded in LandscapeImmersiveController so it checks the existing
visibility request flag (isTopBarRequestedVisible) and only calls
showTopBar(animate) when a change is required. Ensure the new method signature
matches callers and preserves the animate parameter while leaving showTopBar
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt`:
- Around line 1460-1462: The fling handler in BaseEditorActivity currently calls
immersiveController?.showTopBar() unconditionally, causing repeated expansion
animations; update the call to an idempotent API (e.g.,
immersiveController?.showTopBarIfNeeded(animate = true)) and implement
showTopBarIfNeeded in LandscapeImmersiveController so it checks the existing
visibility request flag (isTopBarRequestedVisible) and only calls
showTopBar(animate) when a change is required. Ensure the new method signature
matches callers and preserves the animate parameter while leaving showTopBar
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf0d5937-ecbc-47ef-b2ed-5ed50db34d43

📥 Commits

Reviewing files that changed from the base of the PR and between db1755a and 4621f72.

📒 Files selected for processing (1)
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt

@jatezzz jatezzz merged commit a59a64a into stage Apr 1, 2026
2 checks passed
@jatezzz jatezzz deleted the feat/ADFA-3495-swipe-down-top-bar branch April 1, 2026 19:08
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