Example usage for android.view.accessibility AccessibilityNodeInfo addAction

List of usage examples for android.view.accessibility AccessibilityNodeInfo addAction

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityNodeInfo addAction.

Prototype

@Deprecated
public void addAction(int action) 

Source Link

Document

Adds an action that can be performed on the node.

Usage

From source file:com.jarklee.materialdatetimepicker.time.RadialPickerLayout.java

/**
 * Necessary for accessibility, to ensure we support "scrolling" forward and backward
 * in the circle./*from w w  w . j a v  a2 s.  co m*/
 */
@Override
@SuppressWarnings("deprecation")
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= 21) {
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        }
    }
}

From source file:android.webkit.AccessibilityInjector.java

/**
 * Initializes an {@link AccessibilityNodeInfo} with the actions and
 * movement granularity levels supported by this
 * {@link AccessibilityInjector}./*from  w  ww .j a  v  a2  s  . c o  m*/
 * <p>
 * If an action identifier is added in this method, this
 * {@link AccessibilityInjector} should also return {@code true} from
 * {@link #supportsAccessibilityAction(int)}.
 * </p>
 *
 * @param info The info to initialize.
 * @see View#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)
 */
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);
}

From source file:android.widget.Gallery.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(Gallery.class.getName());
    info.setScrollable(mItemCount > 1);
    if (isEnabled()) {
        if (mItemCount > 0 && mSelectedPosition < mItemCount - 1) {
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        }/*from   www  .j  av a2 s. c o m*/
        if (isEnabled() && mItemCount > 0 && mSelectedPosition > 0) {
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        }
    }
}

From source file:com.android.launcher2.PagedView.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setScrollable(getPageCount() > 1);
    if (getCurrentPage() < getPageCount() - 1) {
        info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
    }//  w  w w.ja va 2s.c om
    if (getCurrentPage() > 0) {
        info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
    }
}

From source file:cc.flydev.launcher.Page.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setScrollable(getPageCount() > 1);
    if (getCurrentPage() < getPageCount() - 1) {
        info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
    }/*w  w  w.ja v  a  2 s  .c o  m*/
    if (getCurrentPage() > 0) {
        info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    }
}

From source file:com.android.internal.widget.ViewPager.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);

    info.setClassName(ViewPager.class.getName());
    info.setScrollable(canScroll());/*from w  ww  . ja  v  a  2 s .co  m*/

    if (canScrollHorizontally(1)) {
        info.addAction(AccessibilityAction.ACTION_SCROLL_FORWARD);
        info.addAction(AccessibilityAction.ACTION_SCROLL_RIGHT);
    }

    if (canScrollHorizontally(-1)) {
        info.addAction(AccessibilityAction.ACTION_SCROLL_BACKWARD);
        info.addAction(AccessibilityAction.ACTION_SCROLL_LEFT);
    }
}

From source file:com.common.widget.hzlib.AbsListView.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.setClassName(AbsListView.class.getName());
    }/*  w  w w  .  j av  a 2 s .  c  om*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        if (isEnabled()) {
            if (getFirstVisiblePosition() > 0) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
            }
            if (getLastVisiblePosition() < getCount() - 1) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
            }
        }
    }
}

From source file:com.appunite.list.AbsHorizontalListView.java

@Override
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.setClassName(AbsHorizontalListView.class.getName());
    }//from  w w w . ja  v a2s  .  c  o  m
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        if (isEnabled()) {
            if (getFirstVisiblePosition() > 0) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
            }
            if (getLastVisiblePosition() < getCount() - 1) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
            }
        }
    }
}

From source file:com.liu.hz.view.AbsHorizontalListView.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.setClassName(AbsHorizontalListView.class.getName());
    }//from   w  w  w .j a va2  s .  c o  m
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        if (isEnabled()) {
            if (getFirstVisiblePosition() > 0) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
            }
            if (getLastVisiblePosition() < getCount() - 1) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
            }
        }
    }
}

From source file:com.appunite.list.AbsListView.java

@Override
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.setClassName(AbsListView.class.getName());
    }//from ww w .  j a v a  2 s  . c o  m
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        if (isEnabled()) {
            if (getFirstVisiblePosition() > 0) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
            }
            if (getLastVisiblePosition() < getCount() - 1) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
            }
        }
    }
}