[StatusBar][Android] Added StatusBarHandler to have control over statusbar in pages.
#781
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added
StatusBarHandlerto provide per-page control over Android status bar appearance, with support for both modal and non-modal pages.Problem
Previously, status bar color and icon style were set globally across the entire app. When navigating between pages with different backgrounds (e.g., a photo capture page with transparent status bar, then a regular page with colored background), the status bar couldn't adapt automatically. This was especially problematic in modal navigation scenarios.
Solution
Introduced two new properties on
ContentPage:StatusBarColor: Sets the status bar background color for each pageStatusBarStyle: Controls icon color (Clock, battery, etc.)Auto- Automatically determines light/dark icons based on background luminosity (default)Light- Light icons for dark backgroundsDark- Dark icons for light backgroundsThe
StatusBarHandlerautomatically detects modal vs non-modal pages and applies the correct implementation:Status bar updates dynamically in
OnAppearing(), ensuring correct appearance as users navigate.Platform Differences
Android only - iOS status bar is controlled differently through
Info.plistand native APIs.Files Changed
StatusBarHandler.cs- Core status bar management logicFragmentLifeCycleCallback.cs- Registers/unregisters DialogFragment mappingsContentPage.cs- CallsStatusBarHandler.TrySetStatusBarColor()inOnAppearing()ContentPage.Properties.cs- AddedStatusBarColorandStatusBarStylepropertiesUsage Example