Bug 727610: Supporting fullscreen on ICS. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Wed, 15 Feb 2012 16:14:02 -0800
changeset 89837 b6ba04315303eafa314d2715cf3321f7ba226306
parent 89836 03ff5cb466daba5aac03c37ae6fde63f64d80f8a
child 89838 ad596e4e1c79edef95d96c6bedf6cc07948593c8
push idunknown
push userunknown
push dateunknown
reviewersmfinkle
bugs727610
milestone13.0a1
Bug 727610: Supporting fullscreen on ICS. [r=mfinkle]
mobile/android/base/BrowserToolbar.java
mobile/android/base/GeckoActionBar.java
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -317,16 +317,30 @@ public class BrowserToolbar extends Line
         } else if (mode.equals("verified")) {
             mSiteSecurity.setImageLevel(2);
         } else {
             mSiteSecurity.setImageLevel(0);
             mTitleCanExpand = true;
         }
     }
 
+    public void show() {
+        if (Build.VERSION.SDK_INT >= 11)
+            GeckoActionBar.show(GeckoApp.mAppContext);
+        else
+            setVisibility(View.VISIBLE);
+    }
+
+    public void hide() {
+        if (Build.VERSION.SDK_INT >= 11)
+            GeckoActionBar.hide(GeckoApp.mAppContext);
+        else
+            setVisibility(View.GONE);
+    }
+
     public void refresh() {
         Tab tab = Tabs.getInstance().getSelectedTab();
         if (tab != null) {
             setTitle(tab.getDisplayTitle());
             setFavicon(tab.getFavicon());
             setSecurityMode(tab.getSecurityMode());
             setProgressVisibility(tab.isLoading());
             setShadowVisibility(!(tab.getURL().startsWith("about:")));
--- a/mobile/android/base/GeckoActionBar.java
+++ b/mobile/android/base/GeckoActionBar.java
@@ -61,9 +61,13 @@ public class GeckoActionBar {
 
     public static void setCustomView(Activity activity, View view) {
          activity.getActionBar().setCustomView(view);
     }
 
     public static void setDisplayHomeAsUpEnabled(Activity activity, boolean enabled) {
          activity.getActionBar().setDisplayHomeAsUpEnabled(enabled);
     } 
+ 
+    public static void show(Activity activity) {
+        activity.getActionBar().show();
+    }
 }
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1019,23 +1019,23 @@ abstract public class GeckoApp
                     }
                 });
                 setLaunchState(GeckoApp.LaunchState.GeckoRunning);
                 GeckoAppShell.sendPendingEventsToGecko();
                 connectGeckoLayerClient();
             } else if (event.equals("ToggleChrome:Hide")) {
                 mMainHandler.post(new Runnable() {
                     public void run() {
-                        mBrowserToolbar.setVisibility(View.GONE);
+                        mBrowserToolbar.hide();
                     }
                 });
             } else if (event.equals("ToggleChrome:Show")) {
                 mMainHandler.post(new Runnable() {
                     public void run() {
-                        mBrowserToolbar.setVisibility(View.VISIBLE);
+                        mBrowserToolbar.show();
                     }
                 });
             } else if (event.equals("DOMFullScreen:Start")) {
                 mDOMFullScreen = true;
             } else if (event.equals("DOMFullScreen:Stop")) {
                 mDOMFullScreen = false;
             } else if (event.equals("FormAssist:AutoComplete")) {
                 final JSONArray suggestions = message.getJSONArray("suggestions");
@@ -1638,19 +1638,22 @@ abstract public class GeckoApp
             mPluginContainer.updateViewLayout(view, lp);
         }
     }
 
     public void setFullScreen(final boolean fullscreen) {
         mMainHandler.post(new Runnable() { 
             public void run() {
                 // Hide/show the system notification bar
-                getWindow().setFlags(fullscreen ?
-                                     WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
-                                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
+                Window window = getWindow();
+                window.setFlags(fullscreen ?
+                                WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
+                                WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+                window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0);
             }
         });
     }
 
     // The ActionBar needs to be refreshed on rotation as different orientation uses different resources
     public void refreshActionBar() {
         if (Build.VERSION.SDK_INT >= 11) {
             mBrowserToolbar = (BrowserToolbar) getLayoutInflater().inflate(R.layout.browser_toolbar, null);