Repository navigation
feat(android): Add Statusbar.setOverlaysWebView method - #2597
Conversation
jcesarmobile
left a comment
There was a problem hiding this comment.
I have not tested yet, but I find the enabled name confusing, maybe just call it overlay.
Also, getInfo method should return if it's overlaid or not.
And there is a typo on Display content unter (should be under)
As I've not tested, I'm not 100% sure, but since you set the color to transparent, if you disable it, it might lose the previous color, right? I think the previous color should be restored.
|
@jcesarmobile Those are good points that I also thought about. 👍 About the color: I also was not really satisfied with the way it is, but the cordova plugin actually does the same. I suspect that this is because it would be unusual to actually switch the overlaying behavior of the status bar back and forth during runtime? But I share your opinion that this isn't very clean that way. I'll look at restoring it! (and i'm obviously fixing the typo ;D) Thanks for your time! |
jcesarmobile
left a comment
There was a problem hiding this comment.
Tested and works fine.
Requested a few minor changes.
On iOS you also have to add the method here
https://github.com/ionic-team/capacitor/blob/master/ios/Capacitor/Capacitor/Plugins/DefaultPlugins.m#L138
| visible: boolean; | ||
| style: StatusBarStyle; | ||
| color?: string; | ||
| overlaysWebview: boolean; |
There was a problem hiding this comment.
Change the name to overlaid or overlays, and make it optional because iOS doesn't return it
| overlaysWebview: boolean; | |
| overlaid?: boolean; |
|
|
||
| // Display content under transparent status bar (Android only) | ||
| Statusbar.setOverlaysWebView({ | ||
| enabled: true |
There was a problem hiding this comment.
forgot to change the new name here
| enabled: true | |
| overlay: true |
| // Display content under transparent status bar (Android only) | ||
| Statusbar.setOverlaysWebView({ | ||
| enabled: true | ||
| }) |
There was a problem hiding this comment.
Missing ; at the end
| }) | |
| }); |
| data.put("visible", (decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_FULLSCREEN) != View.SYSTEM_UI_FLAG_FULLSCREEN); | ||
| data.put("style", style); | ||
| data.put("color", String.format("#%06X", (0xFFFFFF & window.getStatusBarColor()))); | ||
| data.put("overlaysWebview", (decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); |
There was a problem hiding this comment.
Change the name to overlaid or overlays
| data.put("overlaysWebview", (decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); | |
| data.put("overlaid", (decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); |
|
Hopefully all done now 🙂 Thank you for your time and help! |
jcesarmobile
left a comment
There was a problem hiding this comment.
looks good, thanks for making all the requested changes so fast!
Addition of a new method in the core Statusbar plugin, similar to the
overlaysWebViewmethod/preference of the cordova statusbar plugin. Updated example in the docs for the Statusbar plugin.Works only for android (as discussed in #1876) since on iOS it already handles it correctly on devices with notches.
I'm not confident in my android knowledge these days, so I might have overlooked something. But in my tests everything worked as expected, similar to the cordova plugin.
What I'm not sure about is the correct way to handle that the iOS version of the plugin doesn't implement this feature. I added it with a
"not implemented"response in theStatusbar.swiftfile but I'm not sure if that is all that's needed here.