refactor(android): setStatusBarTransparent (#252)

This commit is contained in:
エリス 2022-10-05 16:29:38 +09:00 committed by GitHub
parent f45cf99a3a
commit 7e9db215cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {