Add performAccessibilityAction to AccessibilityDelegate.

Change-Id: I43dff2ced959af5d8a9ce9ed18858a6e74cb35c6
This commit is contained in:
alanv
2012-05-07 16:57:53 -07:00
parent 911b0c0b15
commit 8eeefefc84
2 changed files with 40 additions and 0 deletions

View File

@@ -24381,6 +24381,7 @@ package android.view {
method public void onInitializeAccessibilityNodeInfo(android.view.View, android.view.accessibility.AccessibilityNodeInfo);
method public void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
method public boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent);
method public boolean performAccessibilityAction(android.view.View, int, android.os.Bundle);
method public void sendAccessibilityEvent(android.view.View, int);
method public void sendAccessibilityEventUnchecked(android.view.View, android.view.accessibility.AccessibilityEvent);
}

View File

@@ -6463,12 +6463,31 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
/**
* Performs the specified accessibility action on the view. For
* possible accessibility actions look at {@link AccessibilityNodeInfo}.
* <p>
* If an {@link AccessibilityDelegate} has been specified via calling
* {@link #setAccessibilityDelegate(AccessibilityDelegate)} its
* {@link AccessibilityDelegate#performAccessibilityAction(View, int, Bundle)}
* is responsible for handling this call.
* </p>
*
* @param action The action to perform.
* @param arguments Optional action arguments.
* @return Whether the action was performed.
*/
public boolean performAccessibilityAction(int action, Bundle arguments) {
if (mAccessibilityDelegate != null) {
return mAccessibilityDelegate.performAccessibilityAction(this, action, arguments);
} else {
return performAccessibilityActionInternal(action, arguments);
}
}
/**
* @see #performAccessibilityAction(int, Bundle)
*
* Note: Called from the default {@link AccessibilityDelegate}.
*/
boolean performAccessibilityActionInternal(int action, Bundle arguments) {
switch (action) {
case AccessibilityNodeInfo.ACTION_CLICK: {
if (isClickable()) {
@@ -17411,6 +17430,26 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
host.sendAccessibilityEventInternal(eventType);
}
/**
* Performs the specified accessibility action on the view. For
* possible accessibility actions look at {@link AccessibilityNodeInfo}.
* <p>
* The default implementation behaves as
* {@link View#performAccessibilityAction(int, Bundle)
* View#performAccessibilityAction(int, Bundle)} for the case of
* no accessibility delegate been set.
* </p>
*
* @param action The action to perform.
* @return Whether the action was performed.
*
* @see View#performAccessibilityAction(int, Bundle)
* View#performAccessibilityAction(int, Bundle)
*/
public boolean performAccessibilityAction(View host, int action, Bundle args) {
return host.performAccessibilityActionInternal(action, args);
}
/**
* Sends an accessibility event. This method behaves exactly as
* {@link #sendAccessibilityEvent(View, int)} but takes as an argument an