diff options
author | Michael Jurka <mikejurka@google.com> | 2011-02-23 11:48:32 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-03-23 11:34:39 -0700 |
commit | 7ef959b9177e1e715b0afe010904455a3d961fc4 (patch) | |
tree | 271602f6c6c508a9275519eae373903c32dc8d54 /src/com/android/launcher2/AllAppsTabbed.java | |
parent | 26976d9b53161f80faf822d482ac771b8621cf31 (diff) | |
download | android_packages_apps_Trebuchet-7ef959b9177e1e715b0afe010904455a3d961fc4.tar.gz android_packages_apps_Trebuchet-7ef959b9177e1e715b0afe010904455a3d961fc4.tar.bz2 android_packages_apps_Trebuchet-7ef959b9177e1e715b0afe010904455a3d961fc4.zip |
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
Diffstat (limited to 'src/com/android/launcher2/AllAppsTabbed.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index 0dd56acff..ee7bfc056 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -29,12 +29,9 @@ import android.util.Log; 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 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans } }; + // 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 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans } }); + // 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); |