-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Prevent exit fullscreen mode from closing application #823
Conversation
Wraps the custom view in a FrameLayout in order to capture key events and redirect them to SystemWebView's dispatchKeyEvent.
When you say this, do you mean when the application has the I'll try to test this tonight. |
@breautek Any update on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested 8.1.0
on chrome webview 77 and confirmed the issue appears, and confirmed that this PR fixes the issue with no obvious side effects.
I've also tested this on chrome webview 69 via emulator and it didn't exhibit the original issue.
Sorry for the late reply, I meant full screen mode on html video player. |
Hi, I recently stumbled on this on an application I'm developing. I've applied the commit fdc4da5 and now backbutton works as expected. Almost anyway :) What happens is,
It works correctly though, if you do it like this
I have the following logs from logcat,
Does not work correctly
It seems like, when pressing the back button twice in a row (ie. not touching anything in the app between), it fires the fires the "stop activity" and then the "destroy activity", which is not the case when I press something in the app between the "back button presses". Any ideas about this ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I followed the instructions to modify my file, but this still doesn't work for me.
Cordova-android@8.1.0
@breautek
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looked OK but there was some formatting that could be corrected. It seems the PR added some extra whitespace/newlines that were not needed or in the wrong place.
Could you correct these?
Co-Authored-By: エリス <erisu@users.noreply.github.com>
Co-Authored-By: エリス <erisu@users.noreply.github.com>
Co-Authored-By: エリス <erisu@users.noreply.github.com>
@breautek - Unfortunately, the newlines around line 520 ( |
Formatting should now be right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Could you please create a new release/tag for this? This is currently only fixed on the master branch. |
Not an extra release, but cordova-android@9 will be released soonish. |
I need this fix too :) please release |
Hi @patchon, For me still not working with cordova-android 9.0.0 where is merged this PR. Same problem of you with plyr.js. |
Platforms affected
Android
Motivation and Context
This PR proposes a simple, quick, solution to overcome a problem with full screen mode that, when on and back button is pressed, the application is closed instead of exiting full screen.
For more details see #822 and also https://bugs.chromium.org/p/chromium/issues/detail?id=999212
Fixes #822
Description
The custom view provided by WebKit on SystemWebChromeClients's
onShowCustomView
method is wrapped in a custom FrameLayout in order to be able to grab key events and redirect them intoSystemWebView
'sdispatchKeyEvent
.Given that the custom view is the one with the focus, that's the one handling input, for this reason, we can hijack those key events and redirect them so that they end up closing the custom view because, as stated on the linked chromium bug (#999212), the
onHideCustomView
method from the WebChromeClient subclass is not being executed for recent versions of Chrome, hence, not exiting full screen mode and instead, closing the MainActivity/ Application.Testing
Manual tests on a Pixel (Android 7.1.2) and Pixel 2 XL (Android 10) with Chrome updated to the most recent version.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)