summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-05-25 22:13:09 -0700
committerMichael Jurka <mikejurka@google.com>2011-05-25 22:24:31 -0700
commit87b1490c5a100619648b251cb2be05c457bede08 (patch)
tree3c2012bc384b2efc6c602778774b93457416e116 /src
parent1a0093367d567294eb6b3c82445cb42c305918ae (diff)
downloadandroid_packages_apps_Trebuchet-87b1490c5a100619648b251cb2be05c457bede08.tar.gz
android_packages_apps_Trebuchet-87b1490c5a100619648b251cb2be05c457bede08.tar.bz2
android_packages_apps_Trebuchet-87b1490c5a100619648b251cb2be05c457bede08.zip
Potential fix for bug 4479399
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java15
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java16
-rw-r--r--src/com/android/launcher2/PagedView.java4
3 files changed, 27 insertions, 8 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 01cf9202f..28f44e4e7 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -69,6 +69,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
private int mLastMeasureWidth = -1;
private int mLastMeasureHeight = -1;
+ private boolean mWaitingToInitPages = true;
private int mMaxCellCountY;
@@ -121,13 +122,16 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
mCellCountY = determineCellCountY(height, layout);
mLastMeasureWidth = width;
mLastMeasureHeight = height;
+ removeAllViews();
+ invalidatePageData();
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (mFirstLayout) {
+ if (mWaitingToInitPages) {
+ mWaitingToInitPages = false;
invalidatePageData();
// invalidatePageData() is what causes the child pages to be created. We need the
@@ -548,12 +552,17 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
}
@Override
- public void syncPages() {
- if (mCellCountX <= 0 || mCellCountY <= 0) {
+ protected void invalidatePageData() {
+ if (mWaitingToInitPages || mCellCountX <= 0 || mCellCountY <= 0) {
// We don't know our size yet, which means we haven't calculated cell count x/y;
// onMeasure will call us once we figure out our size
return;
}
+ super.invalidatePageData();
+ }
+
+ @Override
+ public void syncPages() {
// ensure that we have the right number of pages (min of 1, since we have placeholders)
int numPages = Math.max(1,
(int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY)));
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 406d634bb..f80385610 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -151,6 +151,8 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
private AllAppsPagedView mAllAppsPagedView;
+ private boolean mWaitingToInitPages = true;
+
public CustomizePagedView(Context context) {
this(context, null, 0);
}
@@ -208,6 +210,8 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
mPageContentWidth = layout.getContentWidth();
mPageContentHeight = layout.getContentHeight();
mMinPageWidth = layout.getWidthBeforeFirstLayout();
+ removeAllViews();
+ invalidatePageData();
}
if (mPageContentHeight > 0) {
// Lock our height to the size of the page content
@@ -220,7 +224,8 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (mFirstLayout) {
+ if (mWaitingToInitPages) {
+ mWaitingToInitPages = false;
invalidatePageData();
// invalidatePageData() is what causes the child pages to be created. We need the
@@ -1140,12 +1145,17 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
}
@Override
- public void syncPages() {
- if (mFirstMeasure) {
+ protected void invalidatePageData() {
+ if (mWaitingToInitPages || mCellCountX <= 0 || mCellCountY <= 0) {
// We don't know our size yet, which means we haven't calculated cell count x/y;
// onMeasure will call us once we figure out our size
return;
}
+ super.invalidatePageData();
+ }
+
+ @Override
+ public void syncPages() {
boolean enforceMinimumPagedWidths = false;
boolean centerPagedViewCellLayouts = false;
switch (mCustomizationType) {
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 2dd145d10..aa6bef42c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -111,8 +111,8 @@ public abstract class PagedView extends ViewGroup {
protected int mPageLayoutWidthGap;
protected int mPageLayoutHeightGap;
protected int mPageLayoutMaxHeight;
- protected int mCellCountX = -1;
- protected int mCellCountY = -1;
+ protected int mCellCountX = 0;
+ protected int mCellCountY = 0;
protected boolean mCenterPagesVertically;
protected boolean mAllowOverScroll = true;
protected int mUnboundedScrollX;