Java Code Examples for android.support.v4.view.ViewCompat#performAccessibilityAction()

The following examples show how to use android.support.v4.view.ViewCompat#performAccessibilityAction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TouchExplorationHelper.java    From DateTimepicker with Apache License 2.0 5 votes vote down vote up
@Override
public boolean performAction(int virtualViewId, int action, Bundle arguments) {
    if (virtualViewId == View.NO_ID) {
        return ViewCompat.performAccessibilityAction(mParentView, action, arguments);
    }

    final T item = getItemForId(virtualViewId);
    if (item == null) {
        return false;
    }

    boolean handled = false;

    switch (action) {
        case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
            if (mFocusedItemId != virtualViewId) {
                mFocusedItemId = virtualViewId;
                sendEventForItem(item, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
                handled = true;
            }
            break;
        case AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS:
            if (mFocusedItemId == virtualViewId) {
                mFocusedItemId = INVALID_ID;
                sendEventForItem(item, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
                handled = true;
            }
            break;
    }

    handled |= performActionForItem(item, action, arguments);

    return handled;
}
 
Example 2
Source File: ExploreByTouchHelper.java    From letv with Apache License 2.0 4 votes vote down vote up
private boolean performActionForHost(int action, Bundle arguments) {
    return ViewCompat.performAccessibilityAction(this.mView, action, arguments);
}
 
Example 3
Source File: ExploreByTouchHelper.java    From brailleback with Apache License 2.0 4 votes vote down vote up
@Override
public boolean performAction(int virtualViewId, int action, Bundle arguments) {
    boolean handled = false;

    switch (action) {
        case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
            // Only handle the FOCUS action if it's placing focus on
            // a different view that was previously focused.
            if (mFocusedVirtualViewId != virtualViewId) {
                mFocusedVirtualViewId = virtualViewId;
                mHost.invalidate();
                sendEventForVirtualViewId(virtualViewId,
                        AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
                handled = true;
            }
            break;
        case AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS:
            if (mFocusedVirtualViewId == virtualViewId) {
                mFocusedVirtualViewId = INVALID_ID;
            }
            // Since we're managing focus at the parent level, we are
            // likely to receive a FOCUS action before a CLEAR_FOCUS
            // action. We'll give the benefit of the doubt to the
            // framework and always handle FOCUS_CLEARED.
            mHost.invalidate();
            sendEventForVirtualViewId(virtualViewId,
                    AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
            handled = true;
            break;
        default:
            // Let the node provider handle focus for the root node, but
            // the root node should handle everything else by itself.
            if (virtualViewId == View.NO_ID) {
                return ViewCompat.performAccessibilityAction(mHost, action, arguments);
            }
    }

    // Since the client implementation may want to do something special
    // when a FOCUS event occurs, let them handle all events.
    handled |= performActionForVirtualViewId(virtualViewId, action, arguments);

    return handled;
}
 
Example 4
Source File: ExploreByTouchHelper.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private boolean a(int l, Bundle bundle)
{
    return ViewCompat.performAccessibilityAction(h, l, bundle);
}
 
Example 5
Source File: ExploreByTouchHelper.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
private boolean performActionForHost(int action, Bundle arguments) {
    return ViewCompat.performAccessibilityAction(mView, action, arguments);
}
 
Example 6
Source File: ExploreByTouchHelper.java    From android-recipes-app with Apache License 2.0 4 votes vote down vote up
private boolean performActionForHost(int action, Bundle arguments) {
    return ViewCompat.performAccessibilityAction(mView, action, arguments);
}
 
Example 7
Source File: ExploreByTouchHelper.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
private boolean performActionForHost(int action, Bundle arguments) {
    return ViewCompat.performAccessibilityAction(mView, action, arguments);
}
 
Example 8
Source File: ExploreByTouchHelper.java    From guideshow with MIT License 4 votes vote down vote up
private boolean performActionForHost(int action, Bundle arguments) {
    return ViewCompat.performAccessibilityAction(mView, action, arguments);
}