You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2022/10/05 07:29:43 UTC
[cordova-plugin-statusbar] branch master updated: refactor(android): setStatusBarTransparent (#252)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-statusbar.git
The following commit(s) were added to refs/heads/master by this push:
new 7e9db21 refactor(android): setStatusBarTransparent (#252)
7e9db21 is described below
commit 7e9db215cd94a5cb6de3b1a9703b00a8f74d9fdc
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Wed Oct 5 16:29:38 2022 +0900
refactor(android): setStatusBarTransparent (#252)
---
src/android/StatusBar.java | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/android/StatusBar.java b/src/android/StatusBar.java
index 52c5da3..ea9803c 100644
--- a/src/android/StatusBar.java
+++ b/src/android/StatusBar.java
@@ -181,19 +181,17 @@ public class StatusBar extends CordovaPlugin {
window.setStatusBarColor(color);
}
- private void setStatusBarTransparent(final boolean transparent) {
+ private void setStatusBarTransparent(final boolean isTransparent) {
final Window window = cordova.getActivity().getWindow();
- if (transparent) {
- window.getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ int visibility = isTransparent
+ ? View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ : View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
+
+ window.getDecorView().setSystemUiVisibility(visibility);
+
+ if (isTransparent) {
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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org