From a032cc008618b83ecbbede537517d1e7998e3264 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 7 Mar 2011 16:56:21 -0800 Subject: Add MotionEvent.HOVER_ENTER and HOVER_EXIT. The input dispatcher sends a HOVER_ENTER to a window before dispatching it any HOVER_MOVE events. For compatibility reasons, the window will *also* receive the HOVER_MOVE. When the pointer moves into a different window or the pointer goes down or when events are canceled for some reason, the input dispatcher sends a HOVER_EXIT to the previously hovered window. The view hierarchy behavior is similar. All views under the pointer receive onHoverEvent with HOVER_ENTER followed by any number of HOVER_MOVE events. When the pointer leaves a view, the view receives HOVER_EXIT. Similarly, if a parent view decides to capture hover by returning true from onHoverEvent, the hovered descendants will receive HOVER_EXIT. The default behavior of onHoverEvent is to update the view's hovered state by calling setHovered(true/false). Views can query their current hovered state using isHovered(). For testing purposes, the hovered state is mapped to the pressed drawable state. This will change in a subsequent commit with the introduction of a new hovered drawable state. Change-Id: Ib76a7a90236c8f2c7336e55773acade6346cacbe --- native/include/android/input.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'native') diff --git a/native/include/android/input.h b/native/include/android/input.h index 953ee10..f1738c6 100644 --- a/native/include/android/input.h +++ b/native/include/android/input.h @@ -297,6 +297,14 @@ enum { * may not be the window currently touched. */ AMOTION_EVENT_ACTION_SCROLL = 8, + + /* The pointer is not down but has entered the boundaries of a window or view. + */ + AMOTION_EVENT_ACTION_HOVER_ENTER = 9, + + /* The pointer is not down but has exited the boundaries of a window or view. + */ + AMOTION_EVENT_ACTION_HOVER_EXIT = 10, }; /* -- cgit v1.1