diff options
author | Gilles Debunne <debunne@google.com> | 2011-03-01 13:55:16 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-01 13:55:16 -0800 |
commit | 91b52b189550b20cdb4e3e1920fe81a479aec843 (patch) | |
tree | 28b86e4d917e76c1f47fb080a06c0ca47bcbf798 /core | |
parent | e4dcf0948a7c0b357696a813217f7b7603ffd8ac (diff) | |
parent | 0a1b818b8c45c8b100eeabb5c59bb4d85cf90868 (diff) | |
download | frameworks_base-91b52b189550b20cdb4e3e1920fe81a479aec843.zip frameworks_base-91b52b189550b20cdb4e3e1920fe81a479aec843.tar.gz frameworks_base-91b52b189550b20cdb4e3e1920fe81a479aec843.tar.bz2 |
Merge "AbsListView notifies scroll events to the ViewTreeObserver."
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index b1fdae0..5a4bd04 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1251,6 +1251,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (mOnScrollListener != null) { mOnScrollListener.onScroll(this, mFirstPosition, getChildCount(), mItemCount); } + onScrollChanged(0, 0, 0, 0); // dummy values, View's implementation does not use these. } /** @@ -2789,8 +2790,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (!mDataChanged) { if ((mTouchMode != TOUCH_MODE_FLING) && (motionPosition >= 0) && (getAdapter().isEnabled(motionPosition))) { - // User clicked on an actual view (and was not stopping a fling). It might be a - // click or a scroll. Assume it is a click until proven otherwise + // User clicked on an actual view (and was not stopping a fling). + // It might be a click or a scroll. Assume it is a click until + // proven otherwise mTouchMode = TOUCH_MODE_DOWN; // FIXME Debounce if (mPendingCheckForTap == null) { @@ -2799,9 +2801,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout()); } else { if (ev.getEdgeFlags() != 0 && motionPosition < 0) { - // If we couldn't find a view to click on, but the down event was touching - // the edge, we will bail out and try again. This allows the edge correcting - // code in ViewRoot to try to find a nearby view to select + // If we couldn't find a view to click on, but the down event + // was touching the edge, we will bail out and try again. + // This allows the edge correcting code in ViewRoot to try to + // find a nearby view to select return false; } @@ -3264,18 +3267,20 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } @Override - protected void onOverScrolled(int scrollX, int scrollY, - boolean clampedX, boolean clampedY) { - mScrollY = scrollY; - invalidateParentIfNeeded(); - - if (clampedY) { - // Velocity is broken by hitting the limit; don't start a fling off of this. - if (mVelocityTracker != null) { - mVelocityTracker.clear(); + protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) { + if (mScrollY != scrollY) { + onScrollChanged(mScrollX, scrollY, mScrollX, mScrollY); + mScrollY = scrollY; + invalidateParentIfNeeded(); + + if (clampedY) { + // Velocity is broken by hitting the limit; don't start a fling off of this. + if (mVelocityTracker != null) { + mVelocityTracker.clear(); + } } + awakenScrollBars(); } - awakenScrollBars(); } @Override @@ -4293,17 +4298,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mLastPositionDistanceGuess += incrementalDeltaY; } - if (firstPosition == 0 && firstTop >= listPadding.top && incrementalDeltaY >= 0) { - // Don't need to move views down if the top of the first position - // is already visible - return incrementalDeltaY != 0; - } + final boolean cannotScrollDown = (firstPosition == 0 && + firstTop >= listPadding.top && incrementalDeltaY >= 0); + final boolean cannotScrollUp = (firstPosition + childCount == mItemCount && + lastBottom <= getHeight() - listPadding.bottom && incrementalDeltaY <= 0); - if (firstPosition + childCount == mItemCount && - lastBottom <= getHeight() - listPadding.bottom && - incrementalDeltaY <= 0) { - // Don't need to move views up if the bottom of the last position - // is already visible + if (cannotScrollDown || cannotScrollUp) { return incrementalDeltaY != 0; } |