Support Tab going into fullscreen
Change-Id: Iff65d9c56f3c38119712b01cdd18ce77f52e7337
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 27b2b82..ddc5ad2 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -115,6 +115,7 @@
private NavigationBarBase mNavigationBar;
protected PieControl mPieControl;
private boolean mBlockFocusAnimations;
+ private boolean mFullScreen;
public BaseUi(Activity browser, UiController controller) {
mActivity = browser;
@@ -145,6 +146,7 @@
mTitleBar.setProgress(100);
mNavigationBar = mTitleBar.getNavigationBar();
mUrlBarAutoShowManager = new UrlBarAutoShowManager(this);
+ mFullScreen = false;
}
private void cancelStopToast() {
@@ -193,6 +195,9 @@
if (mCustomView != null) {
mUiController.hideCustomView();
return true;
+ } else if (mFullScreen) {
+ setTabFullscreen(false);
+ return true;
}
return false;
}
@@ -804,7 +809,9 @@
final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (enabled) {
winParams.flags |= bits;
+ mFullScreen = true;
} else {
+ mFullScreen = false;
winParams.flags &= ~bits;
if (mCustomView != null) {
mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
@@ -815,6 +822,25 @@
win.setAttributes(winParams);
}
+ public boolean isTabFullScreen() {
+ return mFullScreen;
+ }
+
+ public void setTabFullscreen(boolean enabled) {
+ setFullscreen(enabled);
+ FrameLayout main = (FrameLayout) mActivity.getWindow()
+ .getDecorView().findViewById(android.R.id.content);
+
+ LinearLayout titleBarParent = (LinearLayout) main.findViewById(R.id.vertical_layout);
+ if (titleBarParent != null) {
+ if (enabled) {
+ titleBarParent.removeView(mFixedTitlebarContainer);
+ } else {
+ titleBarParent.addView(mFixedTitlebarContainer, 1);
+ }
+ }
+ }
+
public Drawable getFaviconDrawable(Bitmap icon) {
Drawable[] array = new Drawable[3];
array[0] = new PaintDrawable(Color.BLACK);
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index c9e785f..ef9f468 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -746,6 +746,24 @@
}
@Override
+ public void toggleFullscreenModeForTab(boolean enterFullscreen) {
+ if (mWebViewController instanceof Controller) {
+ Controller controller = (Controller)mWebViewController;
+ controller.getUi().setTabFullscreen(enterFullscreen);
+ }
+ }
+
+ @Override
+ public boolean isTabFullScreen() {
+ if (mWebViewController instanceof Controller) {
+ Controller controller = (Controller)mWebViewController;
+ return controller.getUi().isTabFullScreen();
+ } else {
+ return false;
+ }
+ }
+
+ @Override
public boolean onCreateWindow(WebView view, final boolean dialog,
final boolean userGesture, final Message resultMsg) {
// only allow new window or sub window for the foreground case
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index 70f0880..342fbdc 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -138,6 +138,10 @@
void setFullscreen(boolean enabled);
+ void setTabFullscreen(boolean enabled);
+
+ boolean isTabFullScreen();
+
void setUseQuickControls(boolean enabled);
public boolean shouldCaptureThumbnails();