AccessibilityNodeInfoCompat.CollectionItemInfoCompat

Added in 1.1.0

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

Constants

const Int

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

const Int

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

const Int

There is no sort direction.

const Int

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

Public functions

Int

Gets the column index at which the item is located.

Int

Gets the number of columns the item spans.

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.

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 function is deprecated.

Use isHeading

Boolean

Gets if the collection item is selected.

java-static AccessibilityNodeInfoCompat.CollectionItemInfoCompat!
obtain(
    rowIndex: Int,
    rowSpan: Int,
    columnIndex: Int,
    columnSpan: Int,
    heading: Boolean
)

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

java-static AccessibilityNodeInfoCompat.CollectionItemInfoCompat!
obtain(
    rowIndex: Int,
    rowSpan: Int,
    columnIndex: Int,
    columnSpan: Int,
    heading: Boolean,
    selected: Boolean
)

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

Constants

SORT_DIRECTION_ASCENDING

const val SORT_DIRECTION_ASCENDING = 1: Int

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

SORT_DIRECTION_DESCENDING

const val SORT_DIRECTION_DESCENDING = 2: Int

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

SORT_DIRECTION_NONE

const val SORT_DIRECTION_NONE = 0: Int

There is no sort direction.

SORT_DIRECTION_OTHER

const val SORT_DIRECTION_OTHER = 3: Int

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

Public functions

getColumnIndex

Added in 1.1.0
fun getColumnIndex(): Int

Gets the column index at which the item is located.

Returns
Int

The column index.

getColumnSpan

Added in 1.1.0
fun getColumnSpan(): Int

Gets the number of columns the item spans.

Returns
Int

The column span.

getColumnTitle

Added in 1.12.0
fun getColumnTitle(): String?

Gets the column title at which the item is located.

Returns
String?

The column title.

getRowIndex

Added in 1.1.0
fun getRowIndex(): Int

Gets the row index at which the item is located.

Returns
Int

The row index.

getRowSpan

Added in 1.1.0
fun getRowSpan(): Int

Gets the number of rows the item spans.

Returns
Int

The row span.

getRowTitle

Added in 1.12.0
fun getRowTitle(): String?

Gets the row title at which the item is located.

Returns
String?

The row title.

getSortDirection

fun getSortDirection(): Int

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
fun isHeading(): Boolean

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
fun isSelected(): Boolean

Gets if the collection item is selected.

Returns
Boolean

If the item is selected.

obtain

Added in 1.1.0
java-static fun obtain(
    rowIndex: Int,
    rowSpan: Int,
    columnIndex: Int,
    columnSpan: Int,
    heading: Boolean
): AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

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

Parameters
rowIndex: Int

The row index at which the item is located.

rowSpan: Int

The number of rows the item spans.

columnIndex: Int

The column index at which the item is located.

columnSpan: Int

The number of columns the item spans.

heading: Boolean

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
java-static fun obtain(
    rowIndex: Int,
    rowSpan: Int,
    columnIndex: Int,
    columnSpan: Int,
    heading: Boolean,
    selected: Boolean
): AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

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

Parameters
rowIndex: Int

The row index at which the item is located.

rowSpan: Int

The number of rows the item spans.

columnIndex: Int

The column index at which the item is located.

columnSpan: Int

The number of columns the item spans.

heading: Boolean

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

selected: Boolean

Whether the item is selected.