Merge "Don't auto scroll empty lists"

This commit is contained in:
Alan Viverette
2014-04-07 16:31:55 +00:00
committed by Android (Google) Code Review

View File

@@ -892,6 +892,10 @@ public abstract class AutoScrollHelper implements View.OnTouchListener {
public boolean canTargetScrollVertically(int direction) {
final AbsListView target = mTarget;
final int itemCount = target.getCount();
if (itemCount == 0) {
return false;
}
final int childCount = target.getChildCount();
final int firstPosition = target.getFirstVisiblePosition();
final int lastPosition = firstPosition + childCount;