Java Code Examples for androidx.core.view.accessibility.AccessibilityNodeInfoCompat#setCollectionInfo()

The following examples show how to use androidx.core.view.accessibility.AccessibilityNodeInfoCompat#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: BottomNavigationMenuView.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  AccessibilityNodeInfoCompat infoCompat = AccessibilityNodeInfoCompat.wrap(info);
  infoCompat.setCollectionInfo(
      CollectionInfoCompat.obtain(
          /* rowCount= */ 1,
          /* columnCount= */ menu.getVisibleItems().size(),
          /* hierarchical= */ false,
          /* selectionMode = */ CollectionInfoCompat.SELECTION_MODE_SINGLE));
}
 
Example 2
Source File: MaterialButtonToggleGroup.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  AccessibilityNodeInfoCompat infoCompat = AccessibilityNodeInfoCompat.wrap(info);
  infoCompat.setCollectionInfo(
      CollectionInfoCompat.obtain(
          /* rowCount= */ 1,
          /* columnCount= */ getVisibleButtonCount(),
          /* hierarchical= */ false,
          /* selectionMode = */ isSingleSelection()
              ? CollectionInfoCompat.SELECTION_MODE_SINGLE
              : CollectionInfoCompat.SELECTION_MODE_MULTIPLE));
}
 
Example 3
Source File: TabLayout.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  AccessibilityNodeInfoCompat infoCompat = AccessibilityNodeInfoCompat.wrap(info);
  infoCompat.setCollectionInfo(
      CollectionInfoCompat.obtain(
          /* rowCount= */ 1,
          /* columnCount= */ getTabCount(),
          /* hierarchical= */ false,
          /* selectionMode = */ CollectionInfoCompat.SELECTION_MODE_SINGLE));
}
 
Example 4
Source File: ChipGroup.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  AccessibilityNodeInfoCompat infoCompat = AccessibilityNodeInfoCompat.wrap(info);
  // -1 for an unknown number of columns in a reflowing layout
  int columnCount = isSingleLine() ? getChipCount() : -1;
  infoCompat.setCollectionInfo(
      CollectionInfoCompat.obtain(
          /* rowCount= */ getRowCount(),
          /* columnCount= */ columnCount,
          /* hierarchical= */ false,
          /* selectionMode = */ isSingleSelection()
              ? CollectionInfoCompat.SELECTION_MODE_SINGLE
              : CollectionInfoCompat.SELECTION_MODE_MULTIPLE));
}
 
Example 5
Source File: NavigationMenuPresenter.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(
    View host, @NonNull AccessibilityNodeInfoCompat info) {
  super.onInitializeAccessibilityNodeInfo(host, info);
  info.setCollectionInfo(CollectionInfoCompat.obtain(adapter.getRowCount(), 0, false));
}