Skip to content

ADFA-3207: Resolve window inset issues#1058

Merged
dara-abijo-adfa merged 6 commits intostagefrom
ADFA-3207-nav-button-obstructs-file-tree
Mar 12, 2026
Merged

ADFA-3207: Resolve window inset issues#1058
dara-abijo-adfa merged 6 commits intostagefrom
ADFA-3207-nav-button-obstructs-file-tree

Conversation

@dara-abijo-adfa
Copy link
Contributor

  • Removed redundant paddings
  • Added necessary insets padding

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

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: 0a6f2335-2b29-4b34-b785-70feb6f71d80

📥 Commits

Reviewing files that changed from the base of the PR and between ed5b198 and 9f74e49.

📒 Files selected for processing (2)
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
  • app/src/main/java/com/itsaky/androidide/fragments/TemplateListFragment.kt
💤 Files with no reviewable changes (1)
  • app/src/main/java/com/itsaky/androidide/fragments/TemplateListFragment.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt

📝 Walkthrough
  • Release notes:

    • Fix: Resolve window inset issues by centralizing bottom inset padding application and removing redundant fragment-level insets handling.
    • MainActivity: Added onApplyWindowInsets(insets: WindowInsetsCompat) override(s) to forward insets to _binding?.root?.applyBottomWindowInsetsPadding(insets) so bottom padding is applied centrally.
    • BaseEditorActivity: Calls _binding?.root?.applyBottomWindowInsetsPadding(insets) during its onApplyWindowInsets handling.
    • TemplateDetailsFragment & TemplateListFragment: Removed fragment-level ViewCompat/WindowInsetsCompat listeners and their bottom-padding adjustments.
    • Insets utility: New View extension applyBottomWindowInsetsPadding(insets: WindowInsetsCompat) added (common/src/main/java/.../InsetUtils.kt) to apply system bar bottom inset to view padding.
    • Layout updates: Removed android:fitsSystemWindows="true" from fragment_delete_project.xml and fragment_saved_projects.xml.
  • Risks / best-practice violations:

    • ⚠️ Potential double/competing inset handling — bottom insets may be applied both by these activities and by any parent/decor view (Edge-to-edge handling), causing duplicated padding or layout shifts.
    • ⚠️ Inconsistent strategy across components — activities now apply insets while fragments no longer do; this mixed approach can cause inconsistent appearance and maintenance complexity.
    • ⚠️ Removal of fitsSystemWindows reduces fallback behavior — if inset application fails or ordering differs at runtime, UI elements might be obscured by system bars.
    • ⚠️ Lifecycle/ordering concerns — applying insets without explicit coordination (attachment state/order with parent inset handlers) can cause transient layout jumps or multiple applications.
    • ⚠️ Missing coordination with existing parent hooks — new calls to applyBottomWindowInsetsPadding do not explicitly integrate with other onApplyWindowInsets/onApplySystemBarInsets hooks, increasing risk of duplicated or missed cases.

Walkthrough

Centralizes window-insets handling by adding activity-level onApplyWindowInsets and a View extension to apply bottom padding, removes fragment-level insets listeners, and removes fitsSystemWindows from two layouts. (49 words)

Changes

Cohort / File(s) Summary
Activity insets
app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt, app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Adds override fun onApplyWindowInsets(insets: WindowInsetsCompat) and invokes applyBottomWindowInsetsPadding(insets) on the root binding to apply bottom inset padding.
Fragment-level removal
app/src/main/java/com/itsaky/androidide/fragments/TemplateDetailsFragment.kt, app/src/main/java/com/itsaky/androidide/fragments/TemplateListFragment.kt
Removes fragment-level OnApplyWindowInsetsListener usage and related bottom-padding adjustments.
Layout XML cleanup
app/src/main/res/layout/fragment_delete_project.xml, app/src/main/res/layout/fragment_saved_projects.xml
Removes android:fitsSystemWindows="true" attributes from affected containers.
Inset utility
common/src/main/java/com/itsaky/androidide/utils/InsetUtils.kt
Adds fun View.applyBottomWindowInsetsPadding(insets: WindowInsetsCompat) extension that reads system bar bottom inset and updates the view's bottom padding.

Sequence Diagram(s)

sequenceDiagram
    participant System as WindowInsets system
    participant Activity as MainActivity / BaseEditorActivity
    participant View as Binding.root (View)
    participant Util as InsetUtils.applyBottomWindowInsetsPadding

    System->>Activity: deliver WindowInsetsCompat
    Activity->>View: onApplyWindowInsets(insets)
    View->>Util: applyBottomWindowInsetsPadding(insets)
    Util->>View: updatePadding(bottom = insets.getInsets(systemBars).bottom)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

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

Poem

🐰
I hop where paddings softly land,
Insets nudged by a gentler hand.
Fragments lighter, layouts lean,
Bottom gaps trimmed nice and clean.
A tiny hop — the UI's seen!

🚥 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: resolving window inset issues by reorganizing how insets are handled across the codebase.
Description check ✅ Passed The description directly relates to the changeset, explaining the removal of redundant paddings and addition of necessary insets padding.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ADFA-3207-nav-button-obstructs-file-tree

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
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: 2

🤖 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 576-580: The onApplyWindowInsets listener registered in
BaseEditorActivity via ViewCompat.setOnApplyWindowInsetsListener(binding.root)
needs an immediate inset dispatch so the bottom padding is applied on first
render; after registering the listener call
ViewCompat.requestApplyInsets(binding.root) to force insets to be delivered
right away (keep the listener body that updates padding from
windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())).

In `@app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt`:
- Around line 113-117: The OnApplyWindowInsets listener on binding.root
(registered via ViewCompat.setOnApplyWindowInsetsListener) may miss the initial
insets because it is attached after layout; after registering the listener, call
ViewCompat.requestApplyInsets(binding.root) so the initial inset pass is
delivered and the bottom padding set by v.updatePadding(bottom = insets.bottom)
is applied immediately.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d97e43d-82f6-4bb8-a4c0-e08c5238ac8a

📥 Commits

Reviewing files that changed from the base of the PR and between 1f41fce and b44db83.

📒 Files selected for processing (6)
  • app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
  • app/src/main/java/com/itsaky/androidide/fragments/TemplateDetailsFragment.kt
  • app/src/main/java/com/itsaky/androidide/fragments/TemplateListFragment.kt
  • app/src/main/res/layout/fragment_delete_project.xml
  • app/src/main/res/layout/fragment_saved_projects.xml
💤 Files with no reviewable changes (2)
  • app/src/main/java/com/itsaky/androidide/fragments/TemplateDetailsFragment.kt
  • app/src/main/java/com/itsaky/androidide/fragments/TemplateListFragment.kt

Copy link
Contributor

@itsaky-adfa itsaky-adfa left a comment

Choose a reason for hiding this comment

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

Requesting a minor (nitpicky?) change. Looks good otherwise.

Copy link
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)
common/src/main/java/com/itsaky/androidide/utils/InsetUtils.kt (1)

67-70: Consider reusing getSystemBarInsets for consistency.

The new function uses insets.getInsets(WindowInsetsCompat.Type.systemBars()) directly, while the existing getSystemBarInsets(insets) function (lines 45-60) handles API-level differences and also includes displayCutout() for API >= R. This creates an inconsistency in how insets are retrieved across the file.

Reusing the existing function would ensure consistent behavior and align with the commit message intent ("Reuse methods").

♻️ Suggested refactor to reuse existing function
 fun View.applyBottomWindowInsetsPadding(insets: WindowInsetsCompat) {
-    val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
+    val systemBars = getSystemBarInsets(insets)
     updatePadding(bottom = systemBars.bottom)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@common/src/main/java/com/itsaky/androidide/utils/InsetUtils.kt` around lines
67 - 70, The function applyBottomWindowInsetsPadding currently calls
insets.getInsets(WindowInsetsCompat.Type.systemBars()) directly; change it to
reuse the existing getSystemBarInsets(insets) helper so API-level handling and
displayCutout support are preserved—retrieve the bottom inset from
getSystemBarInsets(insets) and pass it to updatePadding(bottom = ...); look for
the functions applyBottomWindowInsetsPadding and getSystemBarInsets to make this
replacement.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@common/src/main/java/com/itsaky/androidide/utils/InsetUtils.kt`:
- Around line 67-70: The function applyBottomWindowInsetsPadding currently calls
insets.getInsets(WindowInsetsCompat.Type.systemBars()) directly; change it to
reuse the existing getSystemBarInsets(insets) helper so API-level handling and
displayCutout support are preserved—retrieve the bottom inset from
getSystemBarInsets(insets) and pass it to updatePadding(bottom = ...); look for
the functions applyBottomWindowInsetsPadding and getSystemBarInsets to make this
replacement.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2651c28b-acc7-499e-ae43-df86ae4efd0e

📥 Commits

Reviewing files that changed from the base of the PR and between 0371dcc and ed5b198.

📒 Files selected for processing (3)
  • app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
  • common/src/main/java/com/itsaky/androidide/utils/InsetUtils.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
  • app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt

@dara-abijo-adfa dara-abijo-adfa merged commit 7c74906 into stage Mar 12, 2026
2 checks passed
@dara-abijo-adfa dara-abijo-adfa deleted the ADFA-3207-nav-button-obstructs-file-tree branch March 12, 2026 11:35
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.

3 participants