ADFA-1788 | Fix sidebar overlap with status bar on split-screen resize#840
ADFA-1788 | Fix sidebar overlap with status bar on split-screen resize#840
Conversation
|
Caution Review failedThe pull request is closed. 📝 Walkthrough
Changes
Risks & Best-practice considerations
Testing recommendations
WalkthroughConsolidates sidebar window-inset handling into BaseEditorActivity via a new applySidebarInsets helper, removes fragment-local inset logic, and updates contentCard sizing to respond dynamically to IME visibility while preserving bottom-sheet IME signaling. (≤50 words) Changes
Sequence Diagram(s)sequenceDiagram
participant System as System Insets / IME
participant Activity as BaseEditorActivity
participant Sidebar as EditorSidebarFragment
participant BottomSheet as BottomSheet / ContentCard
System->>Activity: deliver window insets / IME changes
Activity->>Activity: extract systemBars, compute imeInsets / isImeVisible
Activity->>Activity: update editorAppBarLayout top padding
Activity->>Sidebar: applySidebarInsets(systemBars)
Activity->>BottomSheet: update IME visibility & adjust contentCard height (cache real height when hidden)
Sidebar-->>Activity: no longer applies insets itself
Activity-->>System: UI paddings/heights updated
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested Reviewers
Poem
🚥 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
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
🤖 Fix all issues with AI agents
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt`:
- Around line 465-477: The early return when contentCardRealHeight is null
prevents the IME state update and the subsequent onSoftInputChanged() call;
change the branch in BaseEditorActivity (the block using isImeVisible and
contentCardRealHeight) so it does not return early: if contentCardRealHeight is
null, skip the height adjustment but still execute the IME-path logic that
updates isImeVisible state and invokes onSoftInputChanged(), or compute a
fallback baseHeight (e.g., use contentCard.measuredHeight or postpone only the
layout change) before calling _binding?.contentCard?.updateLayoutParams and
onSoftInputChanged(); ensure references to contentCardRealHeight,
_binding?.contentCard, isImeVisible, and onSoftInputChanged() are preserved and
always result in the state update being executed.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.ktapp/src/main/java/com/itsaky/androidide/fragments/sidebar/EditorSidebarFragment.kt
🔇 Additional comments (4)
app/src/main/java/com/itsaky/androidide/fragments/sidebar/EditorSidebarFragment.kt (1)
33-59: LGTM! Clean removal of fragment-level inset handling.Centralizing window insets handling in
BaseEditorActivityis the right approach. Fragment-level inset callbacks can receive stale or inconsistent values during split-screen resizes, which was likely the root cause of the overlap issue.app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt (3)
352-353: LGTM! Proper tracking field for drift prevention.The
sidebarLastInsetTopfield correctly tracks the last applied inset to prevent additive padding accumulation across multiple inset updates.
485-488: LGTM!Clean simplification - stores the inset value for use in
onSwipeRevealDragProgress.
490-495: LGTM! Correct drift prevention logic.The algorithm properly extracts the base padding by subtracting the previously applied inset, then applies the new inset. This prevents additive padding accumulation during repeated inset updates (e.g., split-screen resizes).
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Outdated
Show resolved
Hide resolved
1d8d88f to
c54f8a9
Compare
04b9ba4 to
0ba96f5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt`:
- Around line 459-475: The IME-adjusted height calculation in the isImeVisible
branch can produce negative values; update the logic inside the when
(isImeVisible) branch (involving contentCardRealHeight and updateLayoutParams)
to clamp the computed height to a non-negative minimum (e.g., use max(0,
baseHeight - imeInsets.bottom) or a sensible MIN_HEIGHT) before assigning it to
layout params so height never becomes negative and layout remains stable.
Description
This PR fixes a UI issue where the editor sidebar header (title and first action icon) could render behind the system status bar after resizing the app in split-screen mode.
The fix centralizes system bar inset handling in
BaseEditorActivity(the most reliable inset source during window resizes) and applies the top inset as stable padding to the sidebar host, avoiding inset accumulation and layout drift.Details
systemBars.toppadding to the editor app bar and sidebar duringonApplyWindowInsets, ensuring correct behavior during split-screen resize events.EditorSidebarFragment, which were unreliable during window resize and risked accumulating padding/margins over repeated inset dispatches.Screen_Recording_20260115_155428_Code.on.the.Go.mp4
Ticket
ADFA-1788
Observation