Use tablet UI for large
Bug: 4443420
Change-Id: I51e85a75cc246e940374eca8eae43ddcd3898923
diff --git a/res/layout-xlarge/browser_add_bookmark.xml b/res/layout-w600dp/browser_add_bookmark.xml
similarity index 100%
rename from res/layout-xlarge/browser_add_bookmark.xml
rename to res/layout-w600dp/browser_add_bookmark.xml
diff --git a/res/layout-xlarge/pick_bookmark.xml b/res/layout-w600dp/pick_bookmark.xml
similarity index 100%
rename from res/layout-xlarge/pick_bookmark.xml
rename to res/layout-w600dp/pick_bookmark.xml
diff --git a/res/menu-xlarge/browser.xml b/res/menu-w600dp/browser.xml
similarity index 100%
rename from res/menu-xlarge/browser.xml
rename to res/menu-w600dp/browser.xml
diff --git a/res/values-xlarge-port/dimensions.xml b/res/values-w600dp-port/dimensions.xml
similarity index 100%
rename from res/values-xlarge-port/dimensions.xml
rename to res/values-w600dp-port/dimensions.xml
diff --git a/res/values-w600dp/bools.xml b/res/values-w600dp/bools.xml
new file mode 100644
index 0000000..3218656
--- /dev/null
+++ b/res/values-w600dp/bools.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 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">
+ <bool name="isTablet">true</bool>
+</resources>
diff --git a/res/values-xlarge/dimensions.xml b/res/values-w600dp/dimensions.xml
similarity index 100%
rename from res/values-xlarge/dimensions.xml
rename to res/values-w600dp/dimensions.xml
diff --git a/res/values-xlarge/integers.xml b/res/values-w600dp/integers.xml
similarity index 100%
rename from res/values-xlarge/integers.xml
rename to res/values-w600dp/integers.xml
diff --git a/res/values-xlarge/strings.xml b/res/values-w600dp/strings.xml
similarity index 100%
rename from res/values-xlarge/strings.xml
rename to res/values-w600dp/strings.xml
diff --git a/res/values/bools.xml b/res/values/bools.xml
new file mode 100644
index 0000000..6217de1
--- /dev/null
+++ b/res/values/bools.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 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">
+ <bool name="isTablet">false</bool>
+</resources>
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 3c025d2..a9b65fd 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -96,7 +96,7 @@
}
mController = new Controller(this);
- boolean xlarge = isXlarge(this);
+ boolean xlarge = isTablet(this);
if (xlarge) {
mUi = new XLargeUi(this, mController);
} else {
@@ -113,10 +113,8 @@
mController.start(icicle, getIntent());
}
- public static boolean isXlarge(Context context) {
- return (context.getResources().getConfiguration().screenLayout
- & Configuration.SCREENLAYOUT_SIZE_MASK)
- == Configuration.SCREENLAYOUT_SIZE_XLARGE;
+ public static boolean isTablet(Context context) {
+ return context.getResources().getBoolean(R.bool.isTablet);
}
@VisibleForTesting
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index de28d0d..a3cb9fc 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -262,7 +262,7 @@
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.bookmark, menu);
- if (!BrowserActivity.isXlarge(getActivity())) {
+ if (!BrowserActivity.isTablet(getActivity())) {
MenuItem item = menu.findItem(R.id.add_bookmark);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}
@@ -387,7 +387,7 @@
}
private int getDefaultView() {
- if (BrowserActivity.isXlarge(getActivity())) {
+ if (BrowserActivity.isTablet(getActivity())) {
return VIEW_THUMBNAILS;
}
return VIEW_LIST;
diff --git a/src/com/android/browser/CombinedBookmarkHistoryView.java b/src/com/android/browser/CombinedBookmarkHistoryView.java
index 793f7a2..febf75b 100644
--- a/src/com/android/browser/CombinedBookmarkHistoryView.java
+++ b/src/com/android/browser/CombinedBookmarkHistoryView.java
@@ -157,7 +157,7 @@
}
void setupActionBar(int startingFragment) {
- if (BrowserActivity.isXlarge(mContext)) {
+ if (BrowserActivity.isTablet(mContext)) {
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
| ActionBar.DISPLAY_USE_LOGO);
} else {