Skip to content

ADFA-3987 | Fix persistent space obscuring Find in File dialog#1313

Merged
jatezzz merged 1 commit into
stagefrom
fix/ADFA-3987-search-bar-bottom-gap
May 19, 2026
Merged

ADFA-3987 | Fix persistent space obscuring Find in File dialog#1313
jatezzz merged 1 commit into
stagefrom
fix/ADFA-3987-search-bar-bottom-gap

Conversation

@jatezzz
Copy link
Copy Markdown
Collaborator

@jatezzz jatezzz commented May 15, 2026

Description

Fixed an issue where a persistent white space between the user keyboard and the code character toolbar wasted screen real estate and obscured the Find in File dialog in portrait mode. The layout has been updated to dynamically adjust the bottom margin when the keyboard (IME) is visible, ensuring the search input and action buttons remain fully accessible.

Details

  • Wrapped action buttons (Previous, Next, Replace, Close) into a horizontal LinearLayout within layout_find_in_file.xml to manage their margins collectively.
  • Added a WindowInsetsCompat listener in EditorSearchLayout.kt to detect when the keyboard (IME) is open and dynamically set the bottom margin of the actions container to 0 (or collapsedSheetMargin when closed).
  • Removed the hardcoded layout_marginBottom from the editor_container in content_editor.xml.
Screen.Recording.2026-05-18.at.12.11.24.PM.mov

Ticket

ADFA-3987

Observation

Refactoring the individual action buttons into a LinearLayout with weights simplifies the layout structure and makes it much easier to apply margin changes to the entire button group at once when the keyboard is toggled.

@jatezzz jatezzz requested review from a team, Daniel-ADFA and avestaadfa May 15, 2026 22:26
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e034ff3-1fa6-41ef-b90e-023aa481e154

📥 Commits

Reviewing files that changed from the base of the PR and between 5c35d0a and 711d62c.

📒 Files selected for processing (3)
  • app/src/main/res/layout/content_editor.xml
  • editor/src/main/java/com/itsaky/androidide/editor/ui/EditorSearchLayout.kt
  • editor/src/main/res/layout/layout_find_in_file.xml
✅ Files skipped from review due to trivial changes (1)
  • app/src/main/res/layout/content_editor.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • editor/src/main/res/layout/layout_find_in_file.xml
  • editor/src/main/java/com/itsaky/androidide/editor/ui/EditorSearchLayout.kt

📝 Walkthrough
  • Summary

    • Fixes portrait-mode UI bug where a persistent white space between the software keyboard (IME) and the code character toolbar obscured the Find in File dialog and wasted screen real estate.
  • Changes

    • Dynamic IME handling: Added a WindowInsetsCompat listener in EditorSearchLayout.kt to detect IME visibility and call updateActionsBottomMargin — sets actions container bottom margin to 0 when keyboard is visible and to collapsedSheetMargin when closed.
    • Layout refactor: Grouped Previous / Next / Replace / Close MaterialButtons inside a horizontal LinearLayout (actions_container with android:weightSum="4") in layout_find_in_file.xml so margins can be applied to the button group collectively.
    • Removed static margin: Removed hardcoded android:layout_marginBottom from editor_container in content_editor.xml so the editor area no longer forces dead space above the keyboard.
    • Minor code cleanup: Inlined initialization of findInFileBinding and optionsMenu in EditorSearchLayout.kt and simplified exception handling in the search input listener (catching Throwable with an unnamed variable).
  • Risks & Best-practice considerations

    • IME detection edge-cases: Relying on WindowInsetsCompat.Type.ime() may behave inconsistently or with timing delays across Android versions/manufacturers.
    • Layout coupling: Using LinearLayout weightSum for equal button widths couples spacing to the number of buttons; adding/removing buttons requires updating weights/weightSum to preserve layout.
    • Margin assumptions: updateActionsBottomMargin() assumes actions_container uses MarginLayoutParams and remains in the same hierarchy; future view-hierarchy refactors could break the margin adjustments.
    • Exception handling: Broadly catching Throwable may mask underlying issues; consider narrowing the caught exception types if possible.
  • Testing recommendations

    • Verify across Android API levels (especially older inset-handling variants) and across device manufacturers.
    • Test portrait and landscape orientations and multiple keyboard types/heights (including third-party IMEs).
    • Confirm Find in File dialog and action buttons remain fully visible and not overlapped when IME toggles.
    • Validate behavior after adding/removing action buttons or changing the view hierarchy (to ensure margin logic still applies).

Walkthrough

Moves find-in-file action buttons into a weighted horizontal LinearLayout, makes the actions container IME-aware by updating its bottom margin from an OnApplyWindowInsetsListener in EditorSearchLayout (with minor init and catch simplifications), and removes a hardcoded bottom margin from the editor container.

Changes

Find-in-File IME Dynamic Bottom Margin

Layer / File(s) Summary
Find-in-file layout restructuring and IME margin adjustment
editor/src/main/res/layout/layout_find_in_file.xml, editor/src/main/java/com/itsaky/androidide/editor/ui/EditorSearchLayout.kt
Action buttons are moved into @id/actions_container horizontal LinearLayout with android:weightSum="4" and layout_weight="1" per button. EditorSearchLayout imports updateLayoutParams, inlines findInFileBinding and optionsMenu, registers an OnApplyWindowInsetsListener that checks IME isVisible, and implements updateActionsBottomMargin(isImeVisible: Boolean) to set the container's bottomMargin. The regexp catch is simplified.
Editor container margin cleanup
app/src/main/res/layout/content_editor.xml
Removed android:layout_marginBottom from @id/editor_container ViewFlipper to allow runtime inset/margin management.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Daniel-ADFA
  • itsaky-adfa
  • jomen-adfa

Poem

🐰 Buttons line up, weights tucked in a row,
The keyboard arrives — margins ebb and flow,
A listener whispers, helper nudges down,
Editor breathes easy, no more fixed crown,
I hop, I cheer — layout finds its glow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% 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 and specifically describes the main change: fixing a persistent space issue that obscures the Find in File dialog, directly matching the changeset's primary objective.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the problem, the layout restructuring, the IME listener implementation, and the removal of hardcoded margins.
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.

✏️ 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 fix/ADFA-3987-search-bar-bottom-gap

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.

🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/activities/editor/EditorSearchVisibilityObserver.kt (1)

25-34: 💤 Low value

Doc comment claims recursive search but implementation is shallow.

The comment states "Recursively or directly finds the CodeEditorView" but the implementation only checks direct children (one level deep via view.children.firstNotNullOfOrNull). This works for the current wrapper structure but the doc is misleading.

📝 Suggested doc fix
     /**
-     * Recursively or directly finds the [CodeEditorView] within the added view hierarchy.
+     * Finds the [CodeEditorView] either directly or as an immediate child of the added view.
      * Encapsulates the knowledge of how editors are wrapped in the UI layer.
      */
🤖 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/activities/editor/EditorSearchVisibilityObserver.kt`
around lines 25 - 34, The KDoc for findEditorView is incorrect: it claims a
recursive search but the implementation only checks the view itself and its
immediate children via view.children.firstNotNullOfOrNull; update the comment to
accurately reflect the behavior (e.g., "Finds the CodeEditorView directly or
among immediate children") so it matches the implementation, or alternatively
implement true recursion by iterating children and calling findEditorView(child)
for nested ViewGroups; reference the findEditorView function and the use of
view.children.firstNotNullOfOrNull when making the change.
🤖 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/activities/editor/EditorSearchVisibilityObserver.kt`:
- Around line 25-34: The KDoc for findEditorView is incorrect: it claims a
recursive search but the implementation only checks the view itself and its
immediate children via view.children.firstNotNullOfOrNull; update the comment to
accurately reflect the behavior (e.g., "Finds the CodeEditorView directly or
among immediate children") so it matches the implementation, or alternatively
implement true recursion by iterating children and calling findEditorView(child)
for nested ViewGroups; reference the findEditorView function and the use of
view.children.firstNotNullOfOrNull when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 83b677ac-f19c-4932-9d62-cea895b40e03

📥 Commits

Reviewing files that changed from the base of the PR and between 6b65621 and 4553f5d.

📒 Files selected for processing (10)
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/EditorOverlayInset.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/EditorSearchVisibilityObserver.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/FullscreenManager.kt
  • app/src/main/java/com/itsaky/androidide/ui/CodeEditorView.kt
  • app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt
  • app/src/main/res/layout-land/content_editor.xml
  • app/src/main/res/layout/content_editor.xml
  • editor/src/main/java/com/itsaky/androidide/editor/ui/EditorSearchLayout.kt

@jatezzz jatezzz force-pushed the fix/ADFA-3987-search-bar-bottom-gap branch from 4553f5d to 849cbae Compare May 18, 2026 17:25
@jatezzz jatezzz changed the title ADFA-3987 | Fix unexpected blank space below search bar ADFA-3987 | Fix persistent space obscuring Find in File dialog May 18, 2026
@jatezzz jatezzz requested review from a team, Daniel-ADFA and dara-abijo-adfa and removed request for avestaadfa May 18, 2026 17:32
@jatezzz jatezzz force-pushed the fix/ADFA-3987-search-bar-bottom-gap branch from 849cbae to 5c35d0a Compare May 18, 2026 21:27
Copy link
Copy Markdown
Contributor

@dara-abijo-adfa dara-abijo-adfa left a comment

Choose a reason for hiding this comment

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

I'm raising this because I see changes in the find in file dialog.
The visibility issues with the dialog were fixed in #1295

I don't think the problem reported in the ticket is primarily with the dialog, but the extra space between the symbols view and the keyboard.

@jatezzz Could you provide more information on why those changes were needed?
Thanks.

@jatezzz
Copy link
Copy Markdown
Collaborator Author

jatezzz commented May 19, 2026

I'm raising this because I see changes in the find in file dialog. The visibility issues with the dialog were fixed in #1295

I don't think the problem reported in the ticket is primarily with the dialog, but the extra space between the symbols view and the keyboard.

@jatezzz Could you provide more information on why those changes were needed? Thanks.

Hi @dara-abijo-adfa, thanks for bringing that up! While #1295 addressed some visibility issues, it left a layout bug that is still present on stage.

I've attached a quick video for context. You'll notice a big blank space between the search bar and the bottom sheet, as well as on top of the collapsed drawer. My changes in the find in file dialog are necessary to remove those hardcoded spaces. By wrapping the buttons and adding the WindowInsetsCompat.Type.ime() listener, the margins now adjust dynamically only when the keyboard is actually visible, fixing the dead space issue.

Screen.Recording.2026-05-19.at.8.16.26.AM.mov

Adjust action container margins dynamically based on IME visibility to save screen real estate.
@jatezzz jatezzz force-pushed the fix/ADFA-3987-search-bar-bottom-gap branch from 5c35d0a to 711d62c Compare May 19, 2026 13:29
@dara-abijo-adfa
Copy link
Copy Markdown
Contributor

dara-abijo-adfa commented May 19, 2026

I'm raising this because I see changes in the find in file dialog. The visibility issues with the dialog were fixed in #1295
I don't think the problem reported in the ticket is primarily with the dialog, but the extra space between the symbols view and the keyboard.
@jatezzz Could you provide more information on why those changes were needed? Thanks.

Hi @dara-abijo-adfa, thanks for bringing that up! While #1295 addressed some visibility issues, it left a layout bug that is still present on stage.

I've attached a quick video for context. You'll notice a big blank space between the search bar and the bottom sheet, as well as on top of the collapsed drawer. My changes in the find in file dialog are necessary to remove those hardcoded spaces. By wrapping the buttons and adding the WindowInsetsCompat.Type.ime() listener, the margins now adjust dynamically only when the keyboard is actually visible, fixing the dead space issue.

Screen.Recording.2026-05-19.at.8.16.26.AM.mov

@jatezzz I think the main issue is the blank space above the collapsed drawer, and that also seems to be what’s causing the gap between the search dialog and the bottom sheet. It doesn’t appear to be related to the search dialog itself since the space is still visible even when the dialog isn’t open.

That said, if you feel your changes are still necessary, I’m okay with that.

@jatezzz jatezzz merged commit ea7052a into stage May 19, 2026
2 checks passed
@jatezzz jatezzz deleted the fix/ADFA-3987-search-bar-bottom-gap branch May 19, 2026 13:49
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.

4 participants