diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-12 11:13:04 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-12 11:13:04 -0700 |
commit | da33d0d139531ff184a1a339b734de00f1cc0743 (patch) | |
tree | 3cff33c6a44e4ac4e45816af2e1b57a3bd2e6722 /core/java | |
parent | c70b64441029b9748eea7f260f1b3521dc58eb91 (diff) | |
parent | 6dfed24158b8fc9150abee23992db621cd82aa43 (diff) | |
download | frameworks_base-da33d0d139531ff184a1a339b734de00f1cc0743.zip frameworks_base-da33d0d139531ff184a1a339b734de00f1cc0743.tar.gz frameworks_base-da33d0d139531ff184a1a339b734de00f1cc0743.tar.bz2 |
Merge change 1424 into donut
* changes:
Fixes 1844680. Interrupted scrolling could lead to rendering artifacts. The ListView was invalidating itself in opaque mode but before the drawing could happen, it was getting rid of its scrolling cache, thus becoming translucent again.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index ffb6785..4f503b4 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -433,7 +433,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te private InputConnection mDefInputConnection; private InputConnectionWrapper mPublicInputConnection; - + + private Runnable mClearScrollingCache; + /** * Interface definition for a callback to be invoked when the list or grid * has been scrolled. @@ -1947,7 +1949,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (y != mLastY) { deltaY -= mMotionCorrection; int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY; - trackMotionScroll(deltaY, incrementalDeltaY, true); + trackMotionScroll(deltaY, incrementalDeltaY); // Check to see if we have bumped into the scroll limit View motionView = this.getChildAt(mMotionPosition - mFirstPosition); @@ -2286,7 +2288,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te delta = Math.max(-(getHeight() - mPaddingBottom - mPaddingTop - 1), delta); } - trackMotionScroll(delta, delta, false); + trackMotionScroll(delta, delta); // Check to see if we have bumped into the scroll limit View motionView = getChildAt(mMotionPosition - mFirstPosition); @@ -2323,16 +2325,23 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } private void clearScrollingCache() { - if (mCachingStarted) { - mCachingStarted = false; - setChildrenDrawnWithCacheEnabled(false); - if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) { - setChildrenDrawingCacheEnabled(false); - } - if (!isAlwaysDrawnWithCacheEnabled()) { - invalidate(); - } + if (mClearScrollingCache == null) { + mClearScrollingCache = new Runnable() { + public void run() { + if (mCachingStarted) { + mCachingStarted = false; + setChildrenDrawnWithCacheEnabled(false); + if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) { + setChildrenDrawingCacheEnabled(false); + } + if (!isAlwaysDrawnWithCacheEnabled()) { + invalidate(); + } + } + } + }; } + post(mClearScrollingCache); } /** @@ -2341,9 +2350,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * @param deltaY Amount to offset mMotionView. This is the accumulated delta since the motion * began. Positive numbers mean the user's finger is moving down the screen. * @param incrementalDeltaY Change in deltaY from the previous event. - * @param invalidate True to make this method call invalidate(), false otherwise. */ - void trackMotionScroll(int deltaY, int incrementalDeltaY, boolean invalidate) { + void trackMotionScroll(int deltaY, int incrementalDeltaY) { final int childCount = getChildCount(); if (childCount == 0) { return; @@ -2377,7 +2385,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (spaceAbove >= absIncrementalDeltaY && spaceBelow >= absIncrementalDeltaY) { hideSelector(); offsetChildrenTopAndBottom(incrementalDeltaY); - if (invalidate) invalidate(); + invalidate(); mMotionViewNewTop = mMotionViewOriginalTop + deltaY; } else { final int firstPosition = mFirstPosition; @@ -2455,7 +2463,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mFirstPosition += count; } - if (invalidate) invalidate(); + invalidate(); fillGap(down); mBlockLayoutRequests = false; |