Skip to content

Restore Android system-bar layout after MAUI 10 edge-to-edge#2285

Open
myieye wants to merge 3 commits into
developfrom
try/android-alternative-safearea-edges
Open

Restore Android system-bar layout after MAUI 10 edge-to-edge#2285
myieye wants to merge 3 commits into
developfrom
try/android-alternative-safearea-edges

Conversation

@myieye
Copy link
Copy Markdown
Collaborator

@myieye myieye commented May 21, 2026

Develop has been broken on Android since the .NET 10 / MAUI 10 bump (#2264): MauiAppCompatActivity.OnCreate now calls WindowCompat.SetDecorFitsSystemWindows(false) unconditionally, the old windowOptOutEdgeToEdgeEnforcement style is deprecated on API ≥ 36, and the BlazorWebView drew under the status / nav bars.

This restores the pre-MAUI-10 look:

  • MainPage.xaml sets SafeAreaEdges="Container" (MAUI 10's official replacement for the deprecated opt-out), which pads the BlazorWebView back inside the safe area.
  • MainActivity paints the surrounding gutter with colorPrimaryDark (the existing brand navy) and pins the system-bar icons to light. Re-applied on OnConfigurationChanged because MAUI re-decides icon appearance on config changes.
  • The deprecated values-v35/styles.xml opt-out and the now-empty values/styles.xml are deleted.

Visually verified on a Pixel 9 / Android 16 emulator across portrait + landscape, system theme toggle, and the in-app theme override.

Considered and rejected: try/android-targetsdk-pin (5-line manifest pin to SDK 35 — doesn't help because MAUI calls SetDecorFitsSystemWindows(false) regardless of targetSdk), try/android-shrink-webview (Agent 2's ~120-line native-band approach, also works but larger), fix/android-edge-to-edge (the embrace-edge-to-edge branch with ~220 lines of CSS / Svelte adjustments). This branch is the smallest of the four that actually fixes the issue.

🤖 Generated with Claude Code

myieye and others added 2 commits May 21, 2026 09:04
MAUI 10's MauiAppCompatActivity.OnCreate unconditionally calls
WindowCompat.SetDecorFitsSystemWindows(window, false), embracing
edge-to-edge regardless of targetSdkVersion. The pre-.NET-10
windowOptOutEdgeToEdgeEnforcement style is therefore moot - MAUI itself
is opting in, not Android API 36.

Fortunately MAUI 10 ships a built-in solution: ContentPage now
implements ISafeAreaView2 and exposes a SafeAreaEdges bindable
property. When set, MAUI's inset listener on the ContentViewGroup
(decompiled at SafeAreaExtensions.ApplyAdjustedSafeAreaInsetsPx) pads
the page so the BlazorWebView sits inside the system-bar safe area.
Default is SafeAreaEdges.None, which is why our untouched ContentPage
draws under the bars today.

Setting SafeAreaEdges="Container" on MainPage.xaml is a 1-line change
that should obviate the AndroidEdgeToEdgeInsets JS-injection workaround
(left in place but unused; can be deleted if this approach is adopted).

Not yet verified on-device - Agent 2 holds the emulator lock.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MAUI 10 / .NET 10 unconditionally puts the activity in edge-to-edge mode
on Android, so the existing windowOptOutEdgeToEdgeEnforcement style was
a no-op and the BlazorWebView was drawing behind the system bars.

MainPage's SafeAreaEdges="Container" (from the previous commit) pads the
WebView back inside the safe area. This commit paints the surrounding
gutter with the brand color (colorPrimaryDark) and pins the system-bar
icons to light, matching the pre-MAUI-10 look across both system theme
toggles and the app's in-app theme override.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the 💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related label May 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 76bb9340-4cac-4640-bab9-ef9c782705db

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR refactors Android edge-to-edge display handling in FwLite by replacing style-based opt-out with runtime system-bar styling. The XAML declares safe-area container behavior; Android code applies branded window colors and insets controller configuration during initialization and after device configuration changes.

Changes

Android Edge-to-Edge Display and Safe-Area Styling

Layer / File(s) Summary
XAML safe-area configuration and documentation
backend/FwLite/FwLiteMaui/MainPage.xaml, backend/FwLite/FwLiteMaui/MainPage.xaml.Android.cs
MainPage now declares SafeAreaEdges="Container" to configure safe-area padding. Inline documentation explains how this affects BlazorWebView padding and system-bar gutter coloring in edge-to-edge mode.
Android system-bar implementation
backend/FwLite/FwLiteMaui/Platforms/Android/MainActivity.cs
MainActivity applies branded system-bar styling via ApplyBrandedSystemBars() helper in OnCreate and re-applies it after configuration changes via new OnConfigurationChanged override. Uses AndroidX insets controller to configure status/navigation bar appearance. Removes previous style-based edge-to-edge opt-out approach.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

💻 FW Lite

Poem

🐰 The edges bloom edge-to-edge so clean,
With SafeAreaEdges in between,
System bars branded, styled just right,
OnConfigChanged keeps them tight,
Android's bounds now safe and seen! 📱✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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 summarizes the main change: restoring Android system-bar layout after the MAUI 10 edge-to-edge upgrade, which is the core issue addressed by the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the MAUI 10 regression, the specific fixes applied to MainPage.xaml and MainActivity, and verification details.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch try/android-alternative-safearea-edges

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

UI unit Tests

  1 files  ±0   59 suites  ±0   28s ⏱️ ±0s
176 tests ±0  176 ✅ ±0  0 💤 ±0  0 ❌ ±0 
245 runs  ±0  245 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 9338808. ± Comparison against base commit e362dd4.

♻️ This comment has been updated with latest results.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 21, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - May 21, 2026, 12:18 PM

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FW Lite issues related to the fw lite application, not miniLcm or crdt related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant