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

The following examples show how to use android.view.accessibility.AccessibilityNodeInfo#setCollectionInfo() . 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: GridView.java    From android_9.0.0_r45 with Apache License 2.0 7 votes vote down vote up
/** @hide */
@Override
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfoInternal(info);

    final int columnsCount = getNumColumns();
    final int rowsCount = getCount() / columnsCount;
    final int selectionMode = getSelectionModeForAccessibility();
    final CollectionInfo collectionInfo = CollectionInfo.obtain(
            rowsCount, columnsCount, false, selectionMode);
    info.setCollectionInfo(collectionInfo);

    if (columnsCount > 0 || rowsCount > 0) {
        info.addAction(AccessibilityAction.ACTION_SCROLL_TO_POSITION);
    }
}
 
Example 2
Source File: ListView.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/** @hide */
@Override
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfoInternal(info);

    final int rowsCount = getCount();
    final int selectionMode = getSelectionModeForAccessibility();
    final CollectionInfo collectionInfo = CollectionInfo.obtain(
            rowsCount, 1, false, selectionMode);
    info.setCollectionInfo(collectionInfo);

    if (rowsCount > 0) {
        info.addAction(AccessibilityAction.ACTION_SCROLL_TO_POSITION);
    }
}
 
Example 3
Source File: LollipopBrowserAccessibilityManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void setAccessibilityNodeInfoCollectionInfo(AccessibilityNodeInfo node,
        int rowCount, int columnCount, boolean hierarchical) {
    node.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(
            rowCount, columnCount, hierarchical));
}