OSDN Git Service

Revert "Handle mouse hover event in AbsListView"
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 7 Mar 2018 08:32:22 +0000 (16:32 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 7 Mar 2018 08:32:22 +0000 (16:32 +0800)
This reverts commit 7c34557f0ca54016ee76fbd9f621511b0397dc60.

core/java/android/widget/AbsListView.java

index 4cfb8b1..91e2f7d 100644 (file)
@@ -3765,39 +3765,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
     }
 
     @Override
-    public boolean onHoverEvent(@NonNull MotionEvent ev) {
-        final int action = ev.getActionMasked();
-
-        // Allow the super class to handle hover state management first.
-        final boolean handled = super.onHoverEvent(ev);
-        if (action == MotionEvent.ACTION_HOVER_ENTER
-                || action == MotionEvent.ACTION_HOVER_MOVE) {
-            final int position = pointToPosition((int) ev.getX(), (int) ev.getY());
-            if (position != INVALID_POSITION && position != mSelectedPosition) {
-                final View hoveredItem = getChildAt(position - getFirstVisiblePosition());
-                if (hoveredItem.isEnabled()) {
-                    // Force a focus so that the proper selector state gets
-                    // used when we update.
-                    requestFocus();
-                    positionSelector(position, hoveredItem);
-                    setSelectedPositionInt(position);
-                    setNextSelectedPositionInt(position);
-                }
-                updateSelectorState();
-            }
-        } else {
-            // Do not cancel the selected position if the selection is visible
-            // by other means.
-            if (!shouldShowSelector()) {
-                setSelectedPositionInt(INVALID_POSITION);
-                setNextSelectedPositionInt(INVALID_POSITION);
-            }
-        }
-
-        return handled;
-    }
-
-    @Override
     public boolean onTouchEvent(MotionEvent ev) {
         if (!isEnabled()) {
             // A disabled view that is clickable still consumes the touch