fix(android): hide nav & title bars when fullscreen is enabled #213
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.
Platforms affected
Android
Motivation and Context
This is a fix for #180
The issue is that when the app is supposed to be in fullscreen mode, the nav and title bars still display while the splashscreen is visible.
Description
Cordova's main activity currently doesn't set the fullscreen flag until it gets focus, so when we check it on plugin init, it's always false. I've added a fallback to read the
Fullscreen
preference if cordova hasn't set flags yet. Long term, I'm planning on doing a separate PR to the cordova-android repo to fix it so that it sets it inonCreate
instead.Note: The issue is 90% fixed, but the nav and title bars still flash in briefly when the splashscreen hides. This is because cordova's activity hasn't set its view flags yet and hasn't gotten focus yet. The separate PR to cordova-android will fix this.
Testing
Ran
npm test
, manually tested the 3 cases of not fullscreen, Fullscreen, and FullscreenNotImmersive.Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)closes #180