Upstream version 6.34.113.0
[platform/framework/web/crosswalk.git] / src / xwalk / app / android / app_template / src / org / xwalk / app / template / AppTemplateActivity.java
index be0c240..f0c556b 100644 (file)
@@ -5,7 +5,10 @@
 package org.xwalk.app.template;
 
 import android.graphics.Color;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
 import android.os.Bundle;
+import android.view.WindowManager;
 import android.view.KeyEvent;
 import android.view.View;
 import android.widget.TextView;
@@ -42,4 +45,26 @@ public class AppTemplateActivity extends XWalkRuntimeActivityBase {
             setContentView(msgText);
         }
     }
+
+    private void enterFullscreen() {
+        if (VERSION.SDK_INT >= VERSION_CODES.KITKAT &&
+                ((getWindow().getAttributes().flags &
+                        WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0)) {
+            View decorView = getWindow().getDecorView();
+            decorView.setSystemUiVisibility(
+                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
+                    View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
+                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
+                    View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
+                    View.SYSTEM_UI_FLAG_FULLSCREEN |
+                    View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
+        }
+    }
+
+    public void setIsFullscreen(boolean isFullscreen) {
+        if (isFullscreen) {
+            enterFullscreen();
+        }
+    }
+
 }