AccessibilityNodeInfo addAction - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AccessibilityNodeInfo addAction method.

This code example shows how to use the following methods:addAction, setClickable, setMovementGranularities
        super(view);
    } 
 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE);
        info.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);
        info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY);
        info.addAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT);
        info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT);
        info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
        info.setClickable(true);
    } 
 
    @Override 
    public boolean supportsAccessibilityAction(int action) {
        if (action == AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY ||
7
CodeRank
This code example shows how to use the following methods:addAction, setClickable, setMovementGranularities
        super(view);
    } 
 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH |
                AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE);
        info.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);
        info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY);
        info.addAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT);
        info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT);
        info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
        info.setClickable(true);
    } 
 
    @Override 
    public boolean supportsAccessibilityAction(int action) {
        if (action == AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY ||
7
CodeRank
This code example shows how to use the following methods:addAction
     * in the circle. 
     */ 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
      super.onInitializeAccessibilityNodeInfo(info);
      info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
      info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    } 
 
    /** 
     * Announce the currently-selected time when launched. 
     */ 
    @Override 
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
            // Clear the event's current text so that only the current time will be spoken. 
            event.getText().clear();
            Time time = new Time();
            time.hour = getHours();
            time.minute = getMinutes();
3
CodeRank
This code example shows how to use the following methods:addAction
     * in the circle. 
     */ 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
      super.onInitializeAccessibilityNodeInfo(info);
      info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
      info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    } 
 
    /** 
     * Announce the currently-selected time when launched. 
     */ 
    @Override 
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
            // Clear the event's current text so that only the current time will be spoken. 
            event.getText().clear();
            Time time = new Time();
            time.hour = getHours();
            time.minute = getMinutes();
3
CodeRank
This code example shows how to use the following methods:addAction, setScrollable
 
    /* Accessibility */ 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setScrollable(getPageCount() > 1);
        if (getCurrentPage() < getPageCount() - 1) { 
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        } 
        if (getCurrentPage() > 0) { 
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        } 
    } 
 
    @Override 
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        event.setScrollable(true);
        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
            event.setFromIndex(mCurrentPage);
2
CodeRank
This code example shows how to use the following methods:addAction, setScrollable
 
    /* Accessibility */ 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setScrollable(getPageCount() > 1);
        if (getCurrentPage() < getPageCount() - 1) { 
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        } 
        if (getCurrentPage() > 0) { 
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        } 
    } 
 
    @Override 
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        event.setScrollable(true);
        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
            event.setFromIndex(mCurrentPage);
3
CodeRank
This code example shows how to use the following methods:addAction, setScrollable
 
    /* Accessibility */ 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setScrollable(getPageCount() > 1);
        if (getCurrentPage() < getPageCount() - 1) { 
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        } 
        if (getCurrentPage() > 0) { 
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        } 
    } 
 
    @Override 
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        event.setScrollable(true);
        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
            event.setFromIndex(mCurrentPage);
2
CodeRank
This code example shows how to use the following methods:addAction, setAccessibilityFocused, setCheckable, setChecked, setClickable
    @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 { 

-2
CodeRank
addAction Method Overview
Adds an action that can be performed on the node.
See Code Examples for other Android AccessibilityNodeInfo Methods: