Don't hide URL bar for tablets in portrait

  Bug: 6420325

Change-Id: Ic3b0f4b99d831c31f349531d5c2b307543f1ed97
diff --git a/res/values-sw600dp-port/bools.xml b/res/values-sw600dp-port/bools.xml
new file mode 100644
index 0000000..245b2a0
--- /dev/null
+++ b/res/values-sw600dp-port/bools.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2012 The Android Open Source Project Licensed under the
+    Apache License, Version 2.0 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of the
+    License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+    applicable law or agreed to in writing, software distributed under the
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+    CONDITIONS OF ANY KIND, either express or implied. See the License for
+    the specific language governing permissions and limitations under the
+    License.
+-->
+<resources
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- hide the title bar -->
+    <bool name="hide_title">false</bool>
+</resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 2cd26a8..3c20f9a 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -13,6 +13,8 @@
 <resources
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <bool name="isTablet">false</bool>
+    <!--  hide the title bar -->
+    <bool name="hide_title">true</bool>
     <bool name="hide_nav_buttons">true</bool>
     <!-- Browser menu toggles -->
     <bool name="menu_show_navigation">true</bool>
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index 9ec972b..479b62e 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -20,6 +20,7 @@
 import android.animation.Animator.AnimatorListener;
 import android.animation.ObjectAnimator;
 import android.content.Context;
+import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -96,6 +97,16 @@
         mSnapshotBar.setTitleBar(this);
     }
 
+    @Override
+    protected void onConfigurationChanged(Configuration config) {
+        super.onConfigurationChanged(config);
+        if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
+            if (!mContext.getResources().getBoolean(R.bool.hide_title)) {
+                show();
+            }
+        }
+    }
+
     public BaseUi getUi() {
         return mBaseUi;
     }
@@ -159,6 +170,7 @@
         if (mUseQuickControls) {
             this.setVisibility(View.GONE);
         } else {
+            if (!mContext.getResources().getBoolean(R.bool.hide_title)) return;
             if (!mSkipTitleBarAnimations) {
                 cancelTitleBarAnimation(false);
                 int visibleHeight = getVisibleTitleHeight();
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index d7f1559..8e874e9 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -199,20 +199,6 @@
         super.editUrl(clearInput, forceIME);
     }
 
-    @Override
-    protected void showTitleBar() {
-        if (canShowTitleBar()) {
-            mTitleBar.show();
-        }
-    }
-
-    @Override
-    protected void hideTitleBar() {
-        if (isTitleBarShowing()) {
-            mTitleBar.hide();
-        }
-    }
-
     // action mode callbacks
 
     @Override