ADFA-3207: Resolve window inset issues#1058
Conversation
dara-abijo-adfa
commented
Mar 9, 2026
- Removed redundant paddings
- Added necessary insets padding
📝 Walkthrough
WalkthroughCentralizes window-insets handling: adds activity-level onApplyWindowInsets calls and a View extension to apply bottom padding, removes fragment-level insets listeners, and drops fitsSystemWindows from two layouts. Changes
Sequence Diagram(s)sequenceDiagram
participant System as WindowInsets system
participant Activity as MainActivity / BaseEditorActivity
participant View as Binding.root (View)
participant Util as applyBottomWindowInsetsPadding
System->>Activity: deliver WindowInsetsCompat
Activity->>View: onApplyWindowInsets(insets)
View->>Util: applyBottomWindowInsetsPadding(insets)
Util->>View: updatePadding(bottom = insets.getInsets(...).bottom)
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
🧪 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: 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
📒 Files selected for processing (6)
app/src/main/java/com/itsaky/androidide/activities/MainActivity.ktapp/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.ktapp/src/main/java/com/itsaky/androidide/fragments/TemplateDetailsFragment.ktapp/src/main/java/com/itsaky/androidide/fragments/TemplateListFragment.ktapp/src/main/res/layout/fragment_delete_project.xmlapp/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
app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt
Outdated
Show resolved
Hide resolved
itsaky-adfa
left a comment
There was a problem hiding this comment.
Requesting a minor (nitpicky?) change. Looks good otherwise.
app/src/main/java/com/itsaky/androidide/activities/MainActivity.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (1)
common/src/main/java/com/itsaky/androidide/utils/InsetUtils.kt (1)
67-70: Consider reusinggetSystemBarInsetsfor consistency.The new function uses
insets.getInsets(WindowInsetsCompat.Type.systemBars())directly, while the existinggetSystemBarInsets(insets)function (lines 45-60) handles API-level differences and also includesdisplayCutout()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
📒 Files selected for processing (3)
app/src/main/java/com/itsaky/androidide/activities/MainActivity.ktapp/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.ktcommon/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