diff options
author | Michael Jurka <mikejurka@google.com> | 2011-05-26 17:10:29 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-05-31 10:47:24 -0700 |
commit | 983e3fdf20acd22b57e3e6f0a309f524c52b62fe (patch) | |
tree | 56bc43ec5fb8d03c3d83a51aafb5681b4907f891 /src/com/android/launcher2/AllAppsTabbed.java | |
parent | 2c30c8596e615f6995d5e48be8b59bd612e63510 (diff) | |
download | android_packages_apps_Trebuchet-983e3fdf20acd22b57e3e6f0a309f524c52b62fe.tar.gz android_packages_apps_Trebuchet-983e3fdf20acd22b57e3e6f0a309f524c52b62fe.tar.bz2 android_packages_apps_Trebuchet-983e3fdf20acd22b57e3e6f0a309f524c52b62fe.zip |
Fix issue where All Apps tab bar was too small
Change-Id: I702ca5ce32a6346f09c61765aa63625d3d50cc92
Diffstat (limited to 'src/com/android/launcher2/AllAppsTabbed.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index e11113f45..27e78d831 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -163,18 +163,28 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans protected void onLayout(boolean changed, int l, int t, int r, int b) { if (mFirstLayout) { mFirstLayout = false; - // Set the width of the tab bar properly - int pageWidth = mAllApps.getPageContentWidth(); - TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs); - 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; } + // Set the width of the tab bar properly + int pageWidth = mAllApps.getPageContentWidth(); + TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs); + 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; + } + + int newWidth = Math.min(getMeasuredWidth(), pageWidth + tabWidgetPadding); + if (newWidth != allAppsTabBar.getLayoutParams().width) { + allAppsTabBar.getLayoutParams().width = newWidth; + post(new Runnable() { + public void run() { + requestLayout(); + } + }); + } + super.onLayout(changed, l, t, r, b); } |