summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-07-19 09:40:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-19 09:40:43 -0700
commit0f6dc027d7d509d7ac7e90fa5c01554ce4349d59 (patch)
tree3ecb194972345605972d041d9efbf78b85854b44 /src
parent49f72a708d4c68dd228497a76a9337b41c91b73d (diff)
parentd52f3d84fc1df6b4c1ae1101eb937ae4eeb32e75 (diff)
downloadandroid_packages_apps_Trebuchet-0f6dc027d7d509d7ac7e90fa5c01554ce4349d59.tar.gz
android_packages_apps_Trebuchet-0f6dc027d7d509d7ac7e90fa5c01554ce4349d59.tar.bz2
android_packages_apps_Trebuchet-0f6dc027d7d509d7ac7e90fa5c01554ce4349d59.zip
Merge "Fixing some issues with our use of GridLayout."
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java13
-rw-r--r--src/com/android/launcher2/PagedViewGridLayout.java1
2 files changed, 5 insertions, 9 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 8a4bdc729..f05946941 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -734,15 +734,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
// Note: We force a measure here to get around the fact that when we do layout calculations
- // immediately after syncing, we don't have a proper width. That said, we already know the
- // expected page width, so we can actually optimize by hiding all the TextView-based
- // children that are expensive to measure, and let that happen naturally later.
- setVisibilityOnChildren(layout, View.GONE);
+ // immediately after syncing, we don't have a proper width.
int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
- setVisibilityOnChildren(layout, View.VISIBLE);
}
private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h,
float scaleX, float scaleY) {
@@ -893,7 +889,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private void onSyncWidgetPageItems(AsyncTaskPageData data) {
int page = data.page;
PagedViewGridLayout layout = (PagedViewGridLayout) getChildAt(page);
- layout.removeAllViews();
+ // Only set the column count once we have items
+ layout.setColumnCount(layout.getCellCountX());
ArrayList<Object> items = data.items;
int count = items.size();
@@ -935,8 +932,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int ix = i % cellCountX;
int iy = i / cellCountX;
GridLayout.LayoutParams lp = new GridLayout.LayoutParams(
- new GridLayout.Group(iy, 1, GridLayout.LEFT),
- new GridLayout.Group(ix, 1, GridLayout.TOP));
+ GridLayout.spec(iy, GridLayout.LEFT, GridLayout.CAN_STRETCH),
+ GridLayout.spec(ix, GridLayout.TOP, GridLayout.CAN_STRETCH));
lp.width = cellWidth;
lp.height = cellHeight;
if (ix > 0) lp.leftMargin = mWidgetWidthGap;
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index a2ab7634c..4131d8b64 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -35,7 +35,6 @@ public class PagedViewGridLayout extends GridLayout implements Page {
super(context, null, 0);
mCellCountX = cellCountX;
mCellCountY = cellCountY;
- setColumnCount(mCellCountX);
}
int getCellCountX() {