-
Notifications
You must be signed in to change notification settings - Fork 481
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
CB-14238: Make transparency of statusbar persistent when hiding and showing statusbar #99
base: master
Are you sure you want to change the base?
Conversation
src/android/StatusBar.java
Outdated
final Window window = cordova.getActivity().getWindow(); | ||
if (transparent) { | ||
window.getDecorView().setSystemUiVisibility( | ||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | ||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); | ||
window.setStatusBarColor(Color.TRANSPARENT); | ||
|
||
if (Build.VERSION.SDK_INT >= 21) { |
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.
Why did this SDK version check get moved inside here?
Does the other stuff also work on earlier versions?
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.
As far as i've checked setSystemUiVisibility
has been added in API 11 https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int) so it seems it should work everywhere
@@ -227,20 +236,22 @@ private void setStatusBarBackgroundColor(final String colorPref) { | |||
} | |||
|
|||
private void setStatusBarTransparent(final boolean transparent) { | |||
if (Build.VERSION.SDK_INT >= 21) { |
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.
Code indentation of the code inside this removed if
should be adapted to match the added this.transparent = transparent;
, 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.
Right. Fixes
src/android/StatusBar.java
Outdated
@@ -96,7 +101,11 @@ public void run() { | |||
// use KitKat here to be aligned with "Fullscreen" preference | |||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | |||
int uiOptions = window.getDecorView().getSystemUiVisibility(); | |||
uiOptions &= ~View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; | |||
if (transparent) { |
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.
Shouldn't this be this.transparent
?
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.
Good catch. Fixes
@janpio whats needed to get this merged? I've pushed fixes to the way i accessed |
Someone of the committers/maintainers with enough Android experience has to be convinced enough that he hits the merge button. I am not, as I have only superficial knowledge of Android. Enough to leave some comments on code, but not enough to actually be sure the code will be ok in production. |
Unfortunately not. You could try emailing the Dev mailing list, see https://cordova.apache.org/contact/. |
@aszmyd Some feedback from other commiters I got when asking for a review of this:
Could you please create said issue and add it to the PR? Open a new one to get the "usual" template for a PR. Thanks. (If changing the commit message is to involved for you, we can fix that when/if merging) |
@janpio I've created JIRA issue: https://issues.apache.org/jira/browse/CB-14238 and renamed PR name and description. Not sure if i should also rename commit name and force git push? It could confuse others that already pulled this branch. |
@aszmyd it should be fine to update by force push (we do this kind of thing all the time). Alternative solution which I think is not necessary is to simply open a new PR. Even fancier is to open a new PR with text like "resolves #99" or "closes #99" in the description (https://help.github.com/articles/closing-issues-using-keywords/). As an aside you may want to maintain your own special fork version until we get a chance to deal with this one. Maybe something like "cordova-plugin-statusbar-transparent" or "cordova-plugin-persistent-statusbar"? |
138b0ed
to
65a8631
Compare
@brodybits thanks. I've pushed clean one commit with name changed. |
A couple minor points FYI:
Thanks for the contribution, I am sure it will help others in the future. |
65a8631
to
515d683
Compare
I do not know why travis build failed for safari browser. |
I restarted the failed Travis jobs manually. |
Platforms affected
Android
What does this PR do?
overlaysWebView(true)
,hide()
,show()
the status bar gets shown without transparency and pushes webview to bottom. And because we wanted to have statusbar transparent (overlaysWebView) from this point the show/hide should toggle the statusbar visibility and it should always show transparent.StatusBarOverlaysWebView
in Android when its pre-defined in projectconfig.xml
What testing has been done on this change?
Manual testing on Android device
Checklist