ADFA-3495 | Add swipe-down gesture to reveal top bar#1141
Conversation
Expose showTopBar and add downward fling detection to gesture listener.
📝 Walkthrough
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
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
📒 Files selected for processing (2)
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.ktapp/src/main/java/com/itsaky/androidide/activities/editor/LandscapeImmersiveController.kt
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Show resolved
Hide resolved
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 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
📒 Files selected for processing (1)
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Description
This PR implements a downward swipe gesture to reveal the immersive top bar in the editor. The
showTopBarmethod inLandscapeImmersiveControllerwas exposed so it could be triggered externally. InBaseEditorActivity, the gesture detector was updated to recognize downward flings originating near the top edge of the screen. This check is intentionally placed before thenoFilesOpenvalidation 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
noFilesOpenblock 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.