AccessibilityNodeInfoCompat.CollectionItemInfoCompat

Added in 1.1.0

public class AccessibilityNodeInfoCompat.CollectionItemInfoCompat


Class with information if a node is a collection item.

A collection item is contained in a collection, it starts at a given row and column in the collection, and spans one or more rows and columns. For example, a header of two related table columns starts at the first row and the first column, spans one row and two columns.

Summary

Nested types

Builder for creating CollectionItemInfoCompat objects.

Constants

static final int

Items are sorted in ascending order (e.g., A-Z, 0-9).

static final int

Items are sorted in descending order (e.g., Z-A, 9-0).

static final int

There is no sort direction.

static final int

Items are sorted, but using a method other than ascending or descending (e.g., based on relevance or a custom algorithm).

Public methods

int

Gets the column index at which the item is located.

int

Gets the number of columns the item spans.

@Nullable String

Gets the column title at which the item is located.

int

Gets the row index at which the item is located.

int

Gets the number of rows the item spans.

@Nullable String

Gets the row title at which the item is located.

int

Gets the sort direction applied to the data associated with this node.

boolean

This method is deprecated.

Use isHeading

boolean

Gets if the collection item is selected.

static AccessibilityNodeInfoCompat.CollectionItemInfoCompat
obtain(
    int rowIndex,
    int rowSpan,
    int columnIndex,
    int columnSpan,
    boolean heading
)

Returns a cached instance if such is available otherwise a new one.

static AccessibilityNodeInfoCompat.CollectionItemInfoCompat
obtain(
    int rowIndex,
    int rowSpan,
    int columnIndex,
    int columnSpan,
    boolean heading,
    boolean selected
)

Returns a cached instance if such is available otherwise a new one.

Constants

SORT_DIRECTION_ASCENDING

public static final int SORT_DIRECTION_ASCENDING = 1

Items are sorted in ascending order (e.g., A-Z, 0-9).

SORT_DIRECTION_DESCENDING

public static final int SORT_DIRECTION_DESCENDING = 2

Items are sorted in descending order (e.g., Z-A, 9-0).

SORT_DIRECTION_NONE

public static final int SORT_DIRECTION_NONE = 0

There is no sort direction.

SORT_DIRECTION_OTHER

public static final int SORT_DIRECTION_OTHER = 3

Items are sorted, but using a method other than ascending or descending (e.g., based on relevance or a custom algorithm).

Public methods

getColumnIndex

Added in 1.1.0
public int getColumnIndex()

Gets the column index at which the item is located.

Returns
int

The column index.

getColumnSpan

Added in 1.1.0
public int getColumnSpan()

Gets the number of columns the item spans.

Returns
int

The column span.

getColumnTitle

Added in 1.12.0
public @Nullable String getColumnTitle()

Gets the column title at which the item is located.

Returns
@Nullable String

The column title.

getRowIndex

Added in 1.1.0
public int getRowIndex()

Gets the row index at which the item is located.

Returns
int

The row index.

getRowSpan

Added in 1.1.0
public int getRowSpan()

Gets the number of rows the item spans.

Returns
int

The row span.

getRowTitle

Added in 1.12.0
public @Nullable String getRowTitle()

Gets the row title at which the item is located.

Returns
@Nullable String

The row title.

getSortDirection

public int getSortDirection()

Gets the sort direction applied to the data associated with this node.

This item can only be set on a heading node within a table collection. Given the heading node's collection item, a subsequent collection item uses this sort direction if it has the same row or column index, and a greater index in the other dimension. For example, an item at row 2, column 2 can reference a heading at row 2, column 1 for its sort direction.

Compatibility:

  • API <36.1: Always returns SORT_DIRECTION_NONE
Returns
int

The current sort direction.

isHeading

Added in 1.1.0
Deprecated in 1.1.0
public boolean isHeading()

Gets if the collection item is a heading. For example, section heading, table header, etc.

Returns
boolean

If the item is a heading.

isSelected

Added in 1.1.0
public boolean isSelected()

Gets if the collection item is selected.

Returns
boolean

If the item is selected.

obtain

Added in 1.1.0
public static AccessibilityNodeInfoCompat.CollectionItemInfoCompat obtain(
    int rowIndex,
    int rowSpan,
    int columnIndex,
    int columnSpan,
    boolean heading
)

Returns a cached instance if such is available otherwise a new one.

Parameters
int rowIndex

The row index at which the item is located.

int rowSpan

The number of rows the item spans.

int columnIndex

The column index at which the item is located.

int columnSpan

The number of columns the item spans.

boolean heading

Whether the item is a heading. This should be set to false and the newer setHeading used to identify headings.

obtain

Added in 1.1.0
public static AccessibilityNodeInfoCompat.CollectionItemInfoCompat obtain(
    int rowIndex,
    int rowSpan,
    int columnIndex,
    int columnSpan,
    boolean heading,
    boolean selected
)

Returns a cached instance if such is available otherwise a new one.

Parameters
int rowIndex

The row index at which the item is located.

int rowSpan

The number of rows the item spans.

int columnIndex

The column index at which the item is located.

int columnSpan

The number of columns the item spans.

boolean heading

Whether the item is a heading. This should be set to false and the newer setHeading used to identify headings.

boolean selected

Whether the item is selected.