Merge "Check if item is selectable before calling on click" into nyc-dev am: 5ae74b7fa6

am: 82036dbe65

* commit '82036dbe6569c807500836d624e1187ed0bb2449':
  Check if item is selectable before calling on click
This commit is contained in:
Yigit Boyar
2016-03-02 06:20:29 +00:00
committed by android-build-merger

View File

@@ -3078,7 +3078,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
final int motionPosition = mClickMotionPosition;
if (adapter != null && mItemCount > 0 &&
motionPosition != INVALID_POSITION &&
motionPosition < adapter.getCount() && sameWindow()) {
motionPosition < adapter.getCount() && sameWindow() &&
adapter.isEnabled(motionPosition)) {
final View view = getChildAt(motionPosition - mFirstPosition);
// If there is no view, something bad happened (the view scrolled off the
// screen, etc.) and we should cancel the click