diff options
author | Michael Jurka <mikejurka@google.com> | 2011-05-17 18:21:03 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-05-18 14:24:52 -0700 |
commit | 4c6016fab10685eea750c092f1ffa3e862c85df2 (patch) | |
tree | e14cba7d3f84490aae7e3fbc0a35c18d4a795af2 /src/com/android/launcher2/AllAppsTabbed.java | |
parent | d1d48a68409c5f0777e608f83950b41a2306f3f3 (diff) | |
download | android_packages_apps_Trebuchet-4c6016fab10685eea750c092f1ffa3e862c85df2.tar.gz android_packages_apps_Trebuchet-4c6016fab10685eea750c092f1ffa3e862c85df2.tar.bz2 android_packages_apps_Trebuchet-4c6016fab10685eea750c092f1ffa3e862c85df2.zip |
Allow determining # of rows/columns for All Apps and Customize at run time
Diffstat (limited to 'src/com/android/launcher2/AllAppsTabbed.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index 96de5a733..a2f10f5ab 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -35,7 +35,6 @@ import android.widget.TabWidget; import android.widget.TextView; import java.util.ArrayList; -import java.util.Random; /** * Implements a tabbed version of AllApps2D. @@ -126,16 +125,6 @@ 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. @@ -175,7 +164,20 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - mFirstLayout = false; + 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; + } super.onLayout(changed, l, t, r, b); } |