diff options
author | Michael Kolb <kolby@google.com> | 2011-10-21 13:34:28 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2011-10-21 13:34:28 -0700 |
commit | c5675ad4baf34547770a98c7c0d8dec7f8fb4999 (patch) | |
tree | c0c1dfb886123148d77502e2183510033ed6f53e | |
parent | 59bf8725cfa019effc19b8fdcdeb117a7f710755 (diff) | |
download | packages_apps_Browser-c5675ad4baf34547770a98c7c0d8dec7f8fb4999.zip packages_apps_Browser-c5675ad4baf34547770a98c7c0d8dec7f8fb4999.tar.gz packages_apps_Browser-c5675ad4baf34547770a98c7c0d8dec7f8fb4999.tar.bz2 |
Fix fullscreen mode
Bug: 5494143
Set fullscreen flags on window
hide system UI
Change-Id: I38714fd3973d2ee0baca51eb89f0ca640cbab225
-rw-r--r-- | src/com/android/browser/BaseUi.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index 26f90b6..ee308f9 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -42,6 +42,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; +import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.webkit.WebChromeClient; @@ -523,6 +524,7 @@ public abstract class BaseUi implements UI { mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS); decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS); mCustomView = view; + setFullscreen(true); mCustomViewCallback = callback; mActivity.setRequestedOrientation(requestedOrientation); } @@ -531,6 +533,7 @@ public abstract class BaseUi implements UI { public void onHideCustomView() { if (mCustomView == null) return; + setFullscreen(false); FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView(); decor.removeView(mFullscreenContainer); mFullscreenContainer = null; @@ -749,14 +752,25 @@ public abstract class BaseUi implements UI { } public void setFullscreen(boolean enabled) { + Window win = mActivity.getWindow(); + WindowManager.LayoutParams winParams = win.getAttributes(); + final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN; if (enabled) { - mActivity.getWindow().setFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); + winParams.flags |= bits; + if (mCustomView != null) { + mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); + } else { + mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); + } } else { - mActivity.getWindow().clearFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN); + winParams.flags &= ~bits; + if (mCustomView != null) { + mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + } else { + mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + } } + win.setAttributes(winParams); } public Drawable getFaviconDrawable(Bitmap icon) { |