Merge "Fixed duplicate call to dispatchOnPopulateAccessibilityEvent()"

main
Ken Wakasa 2011-07-26 15:15:34 -07:00 committed by Android (Google) Code Review
commit 3ca85794a0
2 changed files with 15 additions and 8 deletions

View File

@ -105,13 +105,13 @@ public class AccessibleKeyboardViewProxy {
}
/**
* Receives hover events when accessibility is turned on in API > 11. In
* earlier API levels, events are manually routed from onTouchEvent.
* Receives hover events when accessibility is turned on in SDK versions ICS
* and higher.
*
* @param event The hover event.
* @return {@code true} if the event is handled
*/
public boolean onHoverEvent(MotionEvent event, PointerTracker tracker) {
public boolean dispatchHoverEvent(MotionEvent event, PointerTracker tracker) {
if (mGestureDetector.onHoverEvent(event, this, tracker))
return true;

View File

@ -586,15 +586,22 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
return super.dispatchPopulateAccessibilityEvent(event);
}
public boolean onHoverEvent(MotionEvent event) {
// Since reflection doesn't support calling superclass methods, this
// method checks for the existence of onHoverEvent() in the View class
// before returning a value.
/**
* Receives hover events from the input framework. This method overrides
* View.dispatchHoverEvent(MotionEvent) on SDK version ICS or higher. On
* lower SDK versions, this method is never called.
*
* @param event The motion event to be dispatched.
* @return {@code true} if the event was handled by the view, {@code false}
* otherwise
*/
public boolean dispatchHoverEvent(MotionEvent event) {
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
final PointerTracker tracker = getPointerTracker(0);
return AccessibleKeyboardViewProxy.getInstance().onHoverEvent(event, tracker);
return AccessibleKeyboardViewProxy.getInstance().dispatchHoverEvent(event, tracker);
}
// Reflection doesn't support calling superclass methods.
return false;
}
}