Skip to content

Commit 6f663c1

Browse files
committed
Fix a bug in ListView where touch scrolling could skip a data set change
Bug 2597058 ListView's touch scrolling can query the adapter for new views. As we now flush pending touch events before running layout/draw traversals (when we normally bring ListView back in sync), this can now happen more often. Resync data before executing a scroll if a data set change is pending. Change-Id: I3e4eba4c2537911ba9cb3393ee4d9e68e46f84bb
1 parent 427db9b commit 6f663c1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/java/android/widget/AbsListView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,6 +3179,13 @@ public boolean onTouchEvent(MotionEvent ev) {
31793179
mActivePointerId = ev.getPointerId(pointerIndex);
31803180
}
31813181
final int y = (int) ev.getY(pointerIndex);
3182+
3183+
if (mDataChanged) {
3184+
// Re-sync everything if data has been changed
3185+
// since the scroll operation can query the adapter.
3186+
layoutChildren();
3187+
}
3188+
31823189
switch (mTouchMode) {
31833190
case TOUCH_MODE_DOWN:
31843191
case TOUCH_MODE_TAP:

0 commit comments

Comments
 (0)