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
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 0dd56ac..ee7bfc0 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -29,12 +29,9 @@
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.ViewGroup;
 import android.widget.TabHost;
 import android.widget.TabWidget;
 import android.widget.TextView;
-import android.widget.TabHost.OnTabChangeListener;
-import android.widget.TabHost.TabContentFactory;
 
 import java.util.ArrayList;
 
@@ -82,6 +79,7 @@
             }
         };
 
+        // Create the tabs and wire them up properly
         TextView tabView;
         TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs);
         tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
@@ -119,6 +117,17 @@
             }
         });
 
+        // Set the width of the tab bar properly
+        int pageWidth = mAllApps.getPageContentWidth();
+        View allAppsTabBar = (View) findViewById(R.id.all_apps_tab_bar);
+        if (allAppsTabBar == null) throw new Resources.NotFoundException();
+        int tabWidgetPadding = 0;
+        final int childCount = tabWidget.getChildCount();
+        if (childCount > 0) {
+            tabWidgetPadding += tabWidget.getChildAt(0).getPaddingLeft() * 2;
+        }
+        allAppsTabBar.getLayoutParams().width = pageWidth + tabWidgetPadding;
+
         // It needs to be INVISIBLE so that it will be measured in the layout.
         // Otherwise the animations is messed up when we show it for the first time.
         setVisibility(INVISIBLE);