Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): hide nav & title bars when fullscreen is enabled #213

Merged
merged 2 commits into from
Apr 3, 2022

Conversation

distinctdan
Copy link
Contributor

@distinctdan distinctdan commented May 11, 2019

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 in onCreate 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

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

closes #180

@janpio janpio changed the title (android) GH-180: Fixes nav and title bars still appearing when app is fullscreen fix(android): Fixes nav and title bars still appearing when app is fullscreen Jul 4, 2019
jesse-s added a commit to cookandbecker/cordova-plugin-splashscreen that referenced this pull request Apr 24, 2020
@peitschie
Copy link

Hi!

Just noting, I've tested this on Android 10, and it definitely improves the situation immensely for me.

Is this still being blocked by something? The code presented here makes good sense to me.

@NiklasMerz NiklasMerz added this to the 6.0.1 milestone Apr 2, 2022
@NiklasMerz NiklasMerz requested a review from breautek April 2, 2022 11:15
@erisu erisu changed the title fix(android): Fixes nav and title bars still appearing when app is fullscreen fix(android): hid nav and title bars when fullscreen is enabled Apr 2, 2022
@erisu erisu changed the title fix(android): hid nav and title bars when fullscreen is enabled fix(android): hide nav & title bars when fullscreen is enabled Apr 2, 2022
Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

I haven't ran the code myself but I see other forks applying this change and others who have stated that this change is a major improvement. Additionally the code is well documented.

Copy link
Member

@NiklasMerz NiklasMerz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick test and it looks OK. As @breautek said the code is quite clear and well documented.

@NiklasMerz NiklasMerz merged commit d780b0d into apache:master Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android: App exits fullscreen mode when splash is visible
5 participants