summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedView.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-11-02 14:49:06 -0700
committerAdam Cohen <adamcohen@google.com>2011-11-02 15:52:56 -0700
commit25b2995c6723c01fbabcea04636358501bc8d17a (patch)
tree000b15063b60d4746a683fe1d7fc861f4a04ccb6 /src/com/android/launcher2/PagedView.java
parent4a4f5c355740e0a4ff54b3279a6dd318b4a53aa6 (diff)
downloadandroid_packages_apps_Trebuchet-25b2995c6723c01fbabcea04636358501bc8d17a.tar.gz
android_packages_apps_Trebuchet-25b2995c6723c01fbabcea04636358501bc8d17a.tar.bz2
android_packages_apps_Trebuchet-25b2995c6723c01fbabcea04636358501bc8d17a.zip
Tentative fix for monkey crash, issue 5556086
Change-Id: Iea6b39133b297dc809e64a20d22156f59950db74
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r--src/com/android/launcher2/PagedView.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index d8a8bb260..de45bf50f 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -490,11 +490,14 @@ public abstract class PagedView extends ViewGroup {
heightSize = maxChildHeight + verticalPadding;
}
- updateScrollingIndicatorPosition();
-
setMeasuredDimension(widthSize, heightSize);
- // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions
+ // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions.
+ // We also wait until we set the measured dimensions before flushing the cache as well, to
+ // ensure that the cache is filled with good values.
+ invalidateCachedOffsets();
+ updateScrollingIndicatorPosition();
+
if (childCount > 0) {
mMaxScrollX = getChildOffset(childCount - 1) - getRelativeChildOffset(childCount - 1);
} else {
@@ -597,7 +600,6 @@ public abstract class PagedView extends ViewGroup {
if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) {
mFirstLayout = false;
}
- invalidateCachedOffsets();
}
protected void screenScrolled(int screenCenter) {
@@ -626,11 +628,17 @@ public abstract class PagedView extends ViewGroup {
// in accordance with any scroll effects.
mForceScreenScrolled = true;
invalidate();
+ invalidateCachedOffsets();
}
protected void invalidateCachedOffsets() {
int count = getChildCount();
- if (count == 0) return;
+ if (count == 0) {
+ mChildOffsets = null;
+ mChildRelativeOffsets = null;
+ mChildOffsetsWithLayoutScale = null;
+ return;
+ }
mChildOffsets = new int[count];
mChildRelativeOffsets = new int[count];