Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 418d0cf5 authored by Yigit Boyar's avatar Yigit Boyar
Browse files

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
parent ccb7f018
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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