Java Code Examples for android.view.accessibility.AccessibilityNodeInfo#setAccessibilityFocused()

The following examples show how to use android.view.accessibility.AccessibilityNodeInfo#setAccessibilityFocused() . 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: DrawerLayout.java    From Dashchan with Apache License 2.0 7 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfo dest, AccessibilityNodeInfo src) {
	final Rect rect = mTmpRect;

	src.getBoundsInParent(rect);
	dest.setBoundsInParent(rect);

	src.getBoundsInScreen(rect);
	dest.setBoundsInScreen(rect);

	dest.setVisibleToUser(src.isVisibleToUser());
	dest.setPackageName(src.getPackageName());
	dest.setClassName(src.getClassName());
	dest.setContentDescription(src.getContentDescription());

	dest.setEnabled(src.isEnabled());
	dest.setClickable(src.isClickable());
	dest.setFocusable(src.isFocusable());
	dest.setFocused(src.isFocused());
	dest.setAccessibilityFocused(src.isAccessibilityFocused());
	dest.setSelected(src.isSelected());
	dest.setLongClickable(src.isLongClickable());

	dest.addAction(src.getActions());
}
 
Example 2
Source File: BrowserAccessibilityManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void setAccessibilityNodeInfoBooleanAttributes(AccessibilityNodeInfo node,
        int virtualViewId,
        boolean checkable, boolean checked, boolean clickable,
        boolean enabled, boolean focusable, boolean focused, boolean password,
        boolean scrollable, boolean selected, boolean visibleToUser) {
    node.setCheckable(checkable);
    node.setChecked(checked);
    node.setClickable(clickable);
    node.setEnabled(enabled);
    node.setFocusable(focusable);
    node.setFocused(focused);
    node.setPassword(password);
    node.setScrollable(scrollable);
    node.setSelected(selected);
    node.setVisibleToUser(visibleToUser);

    node.setMovementGranularities(
            AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
            | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD
            | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE);

    if (mAccessibilityFocusId == virtualViewId) {
        node.setAccessibilityFocused(true);
    } else {
        node.setAccessibilityFocused(false);
    }
}
 
Example 3
Source File: BrowserAccessibilityManager.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@CalledByNative
private void setAccessibilityNodeInfoBooleanAttributes(AccessibilityNodeInfo node,
        int virtualViewId, boolean checkable, boolean checked, boolean clickable,
        boolean enabled, boolean focusable, boolean focused, boolean password,
        boolean scrollable, boolean selected, boolean visibleToUser) {
    node.setCheckable(checkable);
    node.setChecked(checked);
    node.setClickable(clickable);
    node.setEnabled(enabled);
    node.setFocusable(focusable);
    node.setFocused(focused);
    node.setPassword(password);
    node.setScrollable(scrollable);
    node.setSelected(selected);
    node.setVisibleToUser(visibleToUser);

    if (focusable) {
        if (focused) {
            node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS);
        } else {
            node.addAction(AccessibilityNodeInfo.ACTION_FOCUS);
        }
    }

    if (mAccessibilityFocusId == virtualViewId) {
        node.setAccessibilityFocused(true);
        node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
    } else {
        node.setAccessibilityFocused(false);
        node.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
    }

    if (clickable) {
        node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
    }
}
 
Example 4
Source File: BrowserAccessibilityManager.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@CalledByNative
private void setAccessibilityNodeInfoBooleanAttributes(AccessibilityNodeInfo node,
        int virtualViewId, boolean checkable, boolean checked, boolean clickable,
        boolean enabled, boolean focusable, boolean focused, boolean password,
        boolean scrollable, boolean selected, boolean visibleToUser) {
    node.setCheckable(checkable);
    node.setChecked(checked);
    node.setClickable(clickable);
    node.setEnabled(enabled);
    node.setFocusable(focusable);
    node.setFocused(focused);
    node.setPassword(password);
    node.setScrollable(scrollable);
    node.setSelected(selected);
    node.setVisibleToUser(visibleToUser);

    if (focusable) {
        if (focused) {
            node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS);
        } else {
            node.addAction(AccessibilityNodeInfo.ACTION_FOCUS);
        }
    }

    if (mAccessibilityFocusId == virtualViewId) {
        node.setAccessibilityFocused(true);
        node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
    } else {
        node.setAccessibilityFocused(false);
        node.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
    }

    if (clickable) {
        node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
    }
}