Restore Android system-bar layout after MAUI 10 edge-to-edge#2285
Restore Android system-bar layout after MAUI 10 edge-to-edge#2285myieye wants to merge 3 commits into
Conversation
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>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis 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. ChangesAndroid Edge-to-Edge Display and Safe-Area Styling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Develop has been broken on Android since the .NET 10 / MAUI 10 bump (#2264):
MauiAppCompatActivity.OnCreatenow callsWindowCompat.SetDecorFitsSystemWindows(false)unconditionally, the oldwindowOptOutEdgeToEdgeEnforcementstyle is deprecated on API ≥ 36, and the BlazorWebView drew under the status / nav bars.This restores the pre-MAUI-10 look:
MainPage.xamlsetsSafeAreaEdges="Container"(MAUI 10's official replacement for the deprecated opt-out), which pads the BlazorWebView back inside the safe area.MainActivitypaints the surrounding gutter withcolorPrimaryDark(the existing brand navy) and pins the system-bar icons to light. Re-applied onOnConfigurationChangedbecause MAUI re-decides icon appearance on config changes.values-v35/styles.xmlopt-out and the now-emptyvalues/styles.xmlare 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 callsSetDecorFitsSystemWindows(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