mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2025-01-18 17:02:49 +08:00
refactor(android): setStatusBarTransparent (#252)
This commit is contained in:
parent
f45cf99a3a
commit
7e9db215cd
@ -181,19 +181,17 @@ public class StatusBar extends CordovaPlugin {
|
|||||||
window.setStatusBarColor(color);
|
window.setStatusBarColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setStatusBarTransparent(final boolean transparent) {
|
private void setStatusBarTransparent(final boolean isTransparent) {
|
||||||
final Window window = cordova.getActivity().getWindow();
|
final Window window = cordova.getActivity().getWindow();
|
||||||
if (transparent) {
|
int visibility = isTransparent
|
||||||
window.getDecorView().setSystemUiVisibility(
|
? View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
: View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
||||||
|
window.getDecorView().setSystemUiVisibility(visibility);
|
||||||
|
|
||||||
|
if (isTransparent) {
|
||||||
window.setStatusBarColor(Color.TRANSPARENT);
|
window.setStatusBarColor(Color.TRANSPARENT);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
window.getDecorView().setSystemUiVisibility(
|
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
| View.SYSTEM_UI_FLAG_VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setStatusBarStyle(final String style) {
|
private void setStatusBarStyle(final String style) {
|
||||||
|
Loading…
Reference in New Issue
Block a user