summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-06-03 11:21:32 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-06-03 11:21:32 -0700
commitdcfc25ca5f5dd3f867e929e34605564162128b45 (patch)
tree19ca8c460f14d58d870d785663d0354579a349cd /src
parent2eee65316fd6b6a0d9e28344321e798b672c1aa7 (diff)
parent4c826609208012e7219ecdacde4348b0dd7973bd (diff)
downloadandroid_packages_apps_Trebuchet-dcfc25ca5f5dd3f867e929e34605564162128b45.tar.gz
android_packages_apps_Trebuchet-dcfc25ca5f5dd3f867e929e34605564162128b45.tar.bz2
android_packages_apps_Trebuchet-dcfc25ca5f5dd3f867e929e34605564162128b45.zip
am 4c826609: am a83ae6bf: am 330ae983: Merge "Fix issue where All Apps tab bar was too small" into honeycomb-mr2
* commit '4c826609208012e7219ecdacde4348b0dd7973bd': Fix issue where All Apps tab bar was too small
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java10
-rw-r--r--src/com/android/launcher2/AllAppsTabbed.java32
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java10
-rw-r--r--src/com/android/launcher2/PagedView.java12
4 files changed, 37 insertions, 27 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 94e6af4c3..f19547086 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -120,8 +120,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
mCellCountY = determineCellCountY(height, layout);
mLastMeasureWidth = width;
mLastMeasureHeight = height;
- removeAllViews();
- invalidatePageData();
+ postInvalidatePageData(true);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@@ -130,12 +129,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mWaitingToInitPages) {
mWaitingToInitPages = false;
- invalidatePageData();
-
- // invalidatePageData() is what causes the child pages to be created. We need the
- // children to be measured before layout, so force a new measure here.
- measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
+ postInvalidatePageData(false);
}
super.onLayout(changed, left, top, right, bottom);
}
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index a2f10f5ab..94488a13b 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -166,18 +166,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);
}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index e1256d08b..932af8915 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -210,8 +210,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
mPageContentWidth = layout.getContentWidth();
mPageContentHeight = layout.getContentHeight();
mMinPageWidth = layout.getWidthBeforeFirstLayout();
- removeAllViews();
- invalidatePageData();
+ postInvalidatePageData(true);
}
if (mPageContentHeight > 0) {
// Lock our height to the size of the page content
@@ -226,12 +225,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mWaitingToInitPages) {
mWaitingToInitPages = false;
- invalidatePageData();
-
- // invalidatePageData() is what causes the child pages to be created. We need the
- // children to be measured before layout, so force a new measure here.
- measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
+ postInvalidatePageData(false);
}
super.onLayout(changed, left, top, right, bottom);
mFirstLayout = false;
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 79f647ad4..8ee381021 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -1549,6 +1549,18 @@ public abstract class PagedView extends ViewGroup {
*/
public abstract void syncPageItems(int page);
+ protected void postInvalidatePageData(final boolean clearViews) {
+ post(new Runnable() {
+ // post the call to avoid a call to requestLayout from a layout pass
+ public void run() {
+ if (clearViews) {
+ removeAllViews();
+ }
+ invalidatePageData();
+ }
+ });
+ }
+
protected void invalidatePageData() {
if (mContentIsRefreshable) {
// Update all the pages