summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-04-02 10:21:55 -0700
committerAdam Powell <adamp@google.com>2010-04-02 10:21:55 -0700
commitb7795432a5512080fae2a0aa123c02b222f7bca6 (patch)
tree5763959fb4e579d1c8d9f2154ba703f8128e297e /core/java
parent61c3a13e5f9d20c621f49598a0082063404c5f7e (diff)
downloadframeworks_base-b7795432a5512080fae2a0aa123c02b222f7bca6.zip
frameworks_base-b7795432a5512080fae2a0aa123c02b222f7bca6.tar.gz
frameworks_base-b7795432a5512080fae2a0aa123c02b222f7bca6.tar.bz2
Fix AbsListView scrolling behavior at edges.
Allow the user to start scrolling back into content immediately after dragging past the end of content. Remove some dead code. Change-Id: Ife8f60499ac58179ba1e2500ca8745916392a4bc
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/AbsListView.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 66461a7..4aae05e 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2059,12 +2059,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
deltaY -= mMotionCorrection;
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
boolean atEdge = false;
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
- motionView = this.getChildAt(mMotionPosition - mFirstPosition);
- if (motionView != null) {
- // Check if the top of the motion view is where it is
- // supposed to be
- final int motionViewRealTop = motionView.getTop();
- if (atEdge) {
- invalidate();
+ if (atEdge && getChildCount() > 0) {
+ // Treat this like we're starting a new scroll from the current
+ // position. This will let the user start scrolling back into
+ // content immediately rather than needing to scroll back to the
+ // point where they hit the limit first.
+ int motionPosition = findMotionRow(y);
+ if (motionPosition >= 0) {
+ final View motionView = getChildAt(motionPosition - mFirstPosition);
+ mMotionViewOriginalTop = motionView.getTop();
}
+ mMotionY = y;
+ mMotionPosition = motionPosition;
+ invalidate();
}
mLastY = y;
}