Check if item is selectable before calling on click
This CL fixes a bug in ListView where it might call onClick on an un-clickable if a new touch arrives before up timeout. We could actually consider making child position non-changable but that will change behavior. This seems safer approach. Bug: 27198796 Change-Id: I7b15d04efa19d1d760a294bd027f3da3aaa3a445
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user