am 21990922: Merge "Fix AbsListView scrolling behavior at edges." into froyo

Merge commit '219909224d9f5fdb4fe1c97fad048894c4619fe7' into froyo-plus-aosp

* commit '219909224d9f5fdb4fe1c97fad048894c4619fe7':
  Fix AbsListView scrolling behavior at edges.
This commit is contained in:
Adam Powell
2010-04-02 11:06:34 -07:00
committed by Android Git Automerger

View File

@ -2059,12 +2059,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
deltaY -= mMotionCorrection; deltaY -= mMotionCorrection;
int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY; int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
int motionViewPrevTop = 0;
View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
if (motionView != null) {
motionViewPrevTop = motionView.getTop();
}
// No need to do all this work if we're not going to move anyway // No need to do all this work if we're not going to move anyway
boolean atEdge = false; boolean atEdge = false;
if (incrementalDeltaY != 0) { if (incrementalDeltaY != 0) {
@ -2072,14 +2066,19 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
} }
// Check to see if we have bumped into the scroll limit // Check to see if we have bumped into the scroll limit
motionView = this.getChildAt(mMotionPosition - mFirstPosition); if (atEdge && getChildCount() > 0) {
if (motionView != null) { // Treat this like we're starting a new scroll from the current
// Check if the top of the motion view is where it is // position. This will let the user start scrolling back into
// supposed to be // content immediately rather than needing to scroll back to the
final int motionViewRealTop = motionView.getTop(); // point where they hit the limit first.
if (atEdge) { int motionPosition = findMotionRow(y);
invalidate(); if (motionPosition >= 0) {
final View motionView = getChildAt(motionPosition - mFirstPosition);
mMotionViewOriginalTop = motionView.getTop();
} }
mMotionY = y;
mMotionPosition = motionPosition;
invalidate();
} }
mLastY = y; mLastY = y;
} }