summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-05-31 15:00:29 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-31 15:00:29 -0700
commit330ae9835c920d4bdba43806d733c350991d0dcf (patch)
tree97f02036d6590a96d6cad63c2d71115f81b56a5d /src/com
parent7593662b2ea083c7092b25e1d984cca1caf56ac7 (diff)
parent983e3fdf20acd22b57e3e6f0a309f524c52b62fe (diff)
downloadandroid_packages_apps_Trebuchet-330ae9835c920d4bdba43806d733c350991d0dcf.tar.gz
android_packages_apps_Trebuchet-330ae9835c920d4bdba43806d733c350991d0dcf.tar.bz2
android_packages_apps_Trebuchet-330ae9835c920d4bdba43806d733c350991d0dcf.zip
Merge "Fix issue where All Apps tab bar was too small" into honeycomb-mr2
Diffstat (limited to 'src/com')
-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 28f44e4e7..fd5979fd6 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -122,8 +122,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
mCellCountY = determineCellCountY(height, layout);
mLastMeasureWidth = width;
mLastMeasureHeight = height;
- removeAllViews();
- invalidatePageData();
+ postInvalidatePageData(true);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@@ -132,12 +131,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 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);
}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index f80385610..d3779c45a 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 aa6bef42c..01b3d8e91 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -1514,6 +1514,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