You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/01/05 11:37:56 UTC

cordova-plugin-statusbar git commit: CB-9513 Allow to show/hide status bar in fullscreen mode. This closes #42

Repository: cordova-plugin-statusbar
Updated Branches:
  refs/heads/master d853f828d -> a4a1065c4


CB-9513 Allow to show/hide status bar in fullscreen mode. This closes #42


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/a4a1065c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/a4a1065c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/a4a1065c

Branch: refs/heads/master
Commit: a4a1065c4f47243f835f195c8359f33c2379922a
Parents: d853f82
Author: Vladimir Kotikov <ko...@gmail.com>
Authored: Tue Dec 29 10:27:43 2015 +0300
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Tue Jan 5 13:37:25 2016 +0300

----------------------------------------------------------------------
 src/android/StatusBar.java | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/a4a1065c/src/android/StatusBar.java
----------------------------------------------------------------------
diff --git a/src/android/StatusBar.java b/src/android/StatusBar.java
index 21a6602..0b7d67c 100644
--- a/src/android/StatusBar.java
+++ b/src/android/StatusBar.java
@@ -23,6 +23,7 @@ import android.app.Activity;
 import android.graphics.Color;
 import android.os.Build;
 import android.util.Log;
+import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
 
@@ -76,6 +77,7 @@ public class StatusBar extends CordovaPlugin {
         Log.v(TAG, "Executing action: " + action);
         final Activity activity = this.cordova.getActivity();
         final Window window = activity.getWindow();
+
         if ("_ready".equals(action)) {
             boolean statusBarVisible = (window.getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == 0;
             callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, statusBarVisible));
@@ -86,6 +88,17 @@ public class StatusBar extends CordovaPlugin {
             this.cordova.getActivity().runOnUiThread(new Runnable() {
                 @Override
                 public void run() {
+                    // SYSTEM_UI_FLAG_FULLSCREEN is available since JellyBean, but we
+                    // 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;
+                        uiOptions &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
+
+                        window.getDecorView().setSystemUiVisibility(uiOptions);
+                        return;
+                    }
+
                     window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
                 }
             });
@@ -96,6 +109,17 @@ public class StatusBar extends CordovaPlugin {
             this.cordova.getActivity().runOnUiThread(new Runnable() {
                 @Override
                 public void run() {
+                    // SYSTEM_UI_FLAG_FULLSCREEN is available since JellyBean, but we
+                    // use KitKat here to be aligned with "Fullscreen"  preference
+                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+                        int uiOptions = window.getDecorView().getSystemUiVisibility()
+                                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                                | View.SYSTEM_UI_FLAG_FULLSCREEN;
+
+                        window.getDecorView().setSystemUiVisibility(uiOptions);
+                        return;
+                    }
+
                     window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
                 }
             });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org