Setting tab bar widths automatically

- will make launcher adapt better to different screen sizes
- also, moved customization tray tab setup code from Launcher to CustomizeTrayTabHost

Change-Id: I27a1acdacd231150bf191548d155c0e94d855796
diff --git a/res/layout-xlarge-land/customization_drawer_tab_contents.xml b/res/layout-xlarge-land/customization_drawer_tab_contents.xml
deleted file mode 100644
index 50e7b66..0000000
--- a/res/layout-xlarge-land/customization_drawer_tab_contents.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-<com.android.launcher2.CustomizePagedView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
-
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    launcher:wallpaperCellSpanX="3"
-    launcher:wallpaperCellCountX="12"
-    launcher:widgetCellCountX="14"
-    launcher:cellCountX="8"
-    launcher:cellCountY="3"
-    launcher:pageLayoutWidthGap="32dp"
-    launcher:pageLayoutHeightGap="12dp"
-    launcher:pageLayoutPaddingTop="40dp"
-    launcher:pageLayoutPaddingBottom="25dp"
-    launcher:pageLayoutPaddingLeft="20dp"
-    launcher:pageLayoutPaddingRight="20dp" />
\ No newline at end of file
diff --git a/res/layout-xlarge-port/customization_drawer_tab_contents.xml b/res/layout-xlarge-port/customization_drawer_tab_contents.xml
deleted file mode 100644
index 0381be0..0000000
--- a/res/layout-xlarge-port/customization_drawer_tab_contents.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-<com.android.launcher2.CustomizePagedView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
-
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    launcher:wallpaperCellSpanX="3"
-    launcher:wallpaperCellCountX="9"
-    launcher:widgetCellCountX="9"
-    launcher:cellCountX="5"
-    launcher:cellCountY="3"
-    launcher:pageLayoutWidthGap="36dp"
-    launcher:pageLayoutHeightGap="12dp"
-    launcher:pageLayoutPaddingTop="40dp"
-    launcher:pageLayoutPaddingBottom="25dp"
-    launcher:pageLayoutPaddingLeft="20dp"
-    launcher:pageLayoutPaddingRight="20dp" />
diff --git a/res/layout-xlarge/all_apps_tabbed.xml b/res/layout-xlarge/all_apps_tabbed.xml
index 2710b32..9937338 100644
--- a/res/layout-xlarge/all_apps_tabbed.xml
+++ b/res/layout-xlarge/all_apps_tabbed.xml
@@ -24,8 +24,11 @@
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
+        <!-- The layout_width of this RelativeLayout gets overwritten in
+             AllAppsTabbed.onFinishInflate -->
         <RelativeLayout
-            android:layout_width="@dimen/all_apps_tabbed_width"
+            android:id="@+id/all_apps_tab_bar"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
             android:background="@drawable/tab_unselected_holo">
diff --git a/res/layout-xlarge/customization_drawer.xml b/res/layout-xlarge/customization_drawer.xml
index dd1234c..98fc9d9 100644
--- a/res/layout-xlarge/customization_drawer.xml
+++ b/res/layout-xlarge/customization_drawer.xml
@@ -13,14 +13,18 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<TabHost xmlns:android="http://schemas.android.com/apk/res/android">
+<com.android.launcher2.CustomizeTrayTabHost
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
+        <!-- The layout_width of this RelativeLayout gets overwritten in
+             CustomizeTrayTabHost.onFinishInflate -->
         <TabWidget
             android:id="@android:id/tabs"
-            android:layout_width="@dimen/customization_drawer_tab_widget_width"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
             android:background="@drawable/tab_unselected_holo"
@@ -29,6 +33,21 @@
             android:id="@android:id/tabcontent"
             android:layout_width="match_parent"
             android:layout_height="@dimen/customization_drawer_content_height">
+            <com.android.launcher2.CustomizePagedView
+                android:id="@+id/customization_drawer_tab_contents"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                launcher:wallpaperCellSpanX="@integer/customization_drawer_contents_wallpaperCellSpanX"
+                launcher:wallpaperCellCountX="@integer/customization_drawer_contents_wallpaperCellCountX"
+                launcher:widgetCellCountX="@integer/customization_drawer_contents_widgetCellCountX"
+                launcher:cellCountX="@integer/customization_drawer_contents_cellCountX"
+                launcher:cellCountY="@integer/customization_drawer_contents_cellCountY"
+                launcher:pageLayoutWidthGap="@dimen/customization_drawer_contents_pageLayoutWidthGap"
+                launcher:pageLayoutHeightGap="12dp"
+                launcher:pageLayoutPaddingTop="40dp"
+                launcher:pageLayoutPaddingBottom="25dp"
+                launcher:pageLayoutPaddingLeft="20dp"
+                launcher:pageLayoutPaddingRight="20dp" />
          </FrameLayout>
       </LinearLayout>
-</TabHost>
\ No newline at end of file
+</com.android.launcher2.CustomizeTrayTabHost>
\ No newline at end of file
diff --git a/res/values-xlarge-land/dimens.xml b/res/values-xlarge-land/dimens.xml
index 27db522..b44a94a 100644
--- a/res/values-xlarge-land/dimens.xml
+++ b/res/values-xlarge-land/dimens.xml
@@ -30,7 +30,6 @@
     <dimen name="customization_drawer_content_min_width">952dp</dimen>
     <dimen name="customization_drawer_tab_widget_width">952dp</dimen>
 
-    <dimen name="all_apps_tabbed_width">952dp</dimen>
     <integer name="all_apps_view_cellCountX">7</integer>
     <integer name="all_apps_view_cellCountY">5</integer>
     <dimen name="all_apps_view_pageLayoutWidthGap">36dp</dimen>
@@ -39,4 +38,11 @@
     <dimen name="all_apps_view_pageLayoutPaddingBottom">14dp</dimen>
     <dimen name="all_apps_view_pageLayoutPaddingLeft">40dp</dimen>
     <dimen name="all_apps_view_pageLayoutPaddingRight">40dp</dimen>
+
+    <integer name="customization_drawer_contents_wallpaperCellSpanX">3</integer>
+    <integer name="customization_drawer_contents_wallpaperCellCountX">12</integer>
+    <integer name="customization_drawer_contents_widgetCellCountX">14</integer>
+    <integer name="customization_drawer_contents_cellCountX">8</integer>
+    <integer name="customization_drawer_contents_cellCountY">3</integer>
+    <dimen name="customization_drawer_contents_pageLayoutWidthGap">32dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
index 72f6d8a..bb410b1 100644
--- a/res/values-xlarge-port/dimens.xml
+++ b/res/values-xlarge-port/dimens.xml
@@ -30,7 +30,6 @@
     <dimen name="customization_drawer_content_min_width">640dp</dimen>
     <dimen name="customization_drawer_tab_widget_width">700dp</dimen>
 
-    <dimen name="all_apps_tabbed_width">700dp</dimen>
     <integer name="all_apps_view_cellCountX">5</integer>
     <integer name="all_apps_view_cellCountY">7</integer>
     <dimen name="all_apps_view_pageLayoutWidthGap">36dp</dimen>
@@ -39,4 +38,11 @@
     <dimen name="all_apps_view_pageLayoutPaddingBottom">10dp</dimen>
     <dimen name="all_apps_view_pageLayoutPaddingLeft">20dp</dimen>
     <dimen name="all_apps_view_pageLayoutPaddingRight">20dp</dimen>
+
+    <integer name="customization_drawer_contents_wallpaperCellSpanX">3</integer>
+    <integer name="customization_drawer_contents_wallpaperCellCountX">9</integer>
+    <integer name="customization_drawer_contents_widgetCellCountX">9</integer>
+    <integer name="customization_drawer_contents_cellCountX">5</integer>
+    <integer name="customization_drawer_contents_cellCountY">3</integer>
+    <dimen name="customization_drawer_contents_pageLayoutWidthGap">36dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/res/values-xlarge/dimens.xml b/res/values-xlarge/dimens.xml
index 421c9e3..2b97697 100644
--- a/res/values-xlarge/dimens.xml
+++ b/res/values-xlarge/dimens.xml
@@ -28,6 +28,9 @@
     <!-- Size of icons in workspace -->
     <dimen name="app_icon_size">72dp</dimen>
 
+    <!-- Size of content of icons in workspace, as specified by the android icon guidelines -->
+    <dimen name="app_icon_content_size">60dp</dimen>
+
     <!-- extra horizontal spacing between mini screen thumbnails ie. in all
          apps and in customization mode -->
     <dimen name="smallScreenExtraSpacing">0dip</dimen>