Refactor system bar visibility handling on Android #2905
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.
Description of Change
Modernized the handling of system bar visibility in the
MauiMediaElement
class by replacing the legacySetSystemBarsVisibility
method with a newSetStatusBarsHidden
method. This leverages modern Android APIs (WindowManagerFlags
andWindowInsetsControllerCompat
) for better compatibility and maintainability.Introduced static properties (
window
,decorView
,insetsController
) to encapsulate window-related logic with improved error handling. Removed legacy code for Android versions below API 30, simplifying the codebase.Updated fullscreen handling logic to align with modern Android development practices. Improved layout invalidation on fullscreen button clicks and ensured consistent system bar visibility management across the codebase.
Enhanced code readability, maintainability, and robustness by reducing duplication, leveraging modern APIs, and improving error handling.
Has legacy support from android 26 and is tested against 26, 33,34, and 35 with both button and gesture navigation.
Linked Issues
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
Tested against android 26, 33, 34, and 35. I tested against gesture navigation and 3 button navigation on each platform with media element sample app page. It fixes the issue raised where tab bar size is incorrect upon leaving full screen mode.