summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-07-12 14:29:11 -0700
committerWinson Chung <winsonc@google.com>2011-07-18 17:01:54 -0700
commitd52f3d84fc1df6b4c1ae1101eb937ae4eeb32e75 (patch)
treed1c982a28904c45cede2bb51fe44157a99e6ae96 /src/com
parent95383fe41dacc45c2aa97e7f47bafebb5b7655d8 (diff)
downloadandroid_packages_apps_Trebuchet-d52f3d84fc1df6b4c1ae1101eb937ae4eeb32e75.tar.gz
android_packages_apps_Trebuchet-d52f3d84fc1df6b4c1ae1101eb937ae4eeb32e75.tar.bz2
android_packages_apps_Trebuchet-d52f3d84fc1df6b4c1ae1101eb937ae4eeb32e75.zip
Fixing some issues with our use of GridLayout.
Change-Id: Id898258b31462f47d65f0ec674786b03a4ca326e
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java13
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java2
-rw-r--r--src/com/android/launcher2/PagedViewGridLayout.java1
3 files changed, 5 insertions, 11 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/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index fc1b01288..39b0a6284 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -221,8 +221,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions");
}
-
-
int numWidthGaps = mCellCountX - 1;
int numHeightGaps = mCellCountY - 1;
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() {