AccessibilityRecordCompat

Added in 1.1.0

public class AccessibilityRecordCompat


Helper for accessing AccessibilityRecord.

Summary

Public constructors

This method is deprecated.

This is not type safe.

Public methods

boolean

This method is deprecated.

Use AccessibilityRecord directly.

int

This method is deprecated.

Use getAddedCount directly.

CharSequence

This method is deprecated.

Use getBeforeText directly.

CharSequence

This method is deprecated.

Use getClassName directly.

CharSequence

This method is deprecated.

Use getContentDescription directly.

int

This method is deprecated.

Use getCurrentItemIndex directly.

int

This method is deprecated.

Use getFromIndex directly.

Object

This method is deprecated.

This method will be removed in a subsequent release of the support library.

int

This method is deprecated.

Use getItemCount directly.

int

This method is deprecated.

Use getMaxScrollX instead.

static int

Gets the max scroll offset of the source left edge in pixels.

int

This method is deprecated.

Use getMaxScrollY instead.

static int

Gets the max scroll offset of the source top edge in pixels.

Parcelable

This method is deprecated.

Use getParcelableData directly.

int

This method is deprecated.

Use getRemovedCount directly.

int

This method is deprecated.

Use getScrollX directly.

int

This method is deprecated.

Use getScrollY directly.

AccessibilityNodeInfoCompat

This method is deprecated.

Use getSource directly.

List<CharSequence>

This method is deprecated.

Use getText directly.

int

This method is deprecated.

Use getToIndex directly.

int

This method is deprecated.

Use getWindowId directly.

int

This method is deprecated.

Use hashCode directly.

boolean

This method is deprecated.

Use isChecked directly.

boolean

This method is deprecated.

Use isEnabled directly.

boolean

This method is deprecated.

Use isFullScreen directly.

boolean

This method is deprecated.

Use isPassword directly.

boolean

This method is deprecated.

Use isScrollable directly.

static AccessibilityRecordCompat

This method is deprecated.

Use obtain directly.

static AccessibilityRecordCompat

This method is deprecated.

Use obtain directly.

void

This method is deprecated.

Use recycle directly.

void
setAddedCount(int addedCount)

This method is deprecated.

Use setAddedCount directly.

void

This method is deprecated.

Use setBeforeText directly.

void
setChecked(boolean isChecked)

This method is deprecated.

Use setChecked directly.

void

This method is deprecated.

Use setClassName directly.

void
setContentDescription(CharSequence contentDescription)

This method is deprecated.

Use setContentDescription directly.

void
setCurrentItemIndex(int currentItemIndex)

This method is deprecated.

Use setCurrentItemIndex directly.

void
setEnabled(boolean isEnabled)

This method is deprecated.

Use isEnabled directly.

void
setFromIndex(int fromIndex)

This method is deprecated.

Use setFromIndex directly.

void
setFullScreen(boolean isFullScreen)

This method is deprecated.

Use setFullScreen directly.

void
setItemCount(int itemCount)

This method is deprecated.

Use setItemCount directly.

void
setMaxScrollX(int maxScrollX)

This method is deprecated.

Use setMaxScrollX instead.

static void
setMaxScrollX(@NonNull AccessibilityRecord record, int maxScrollX)

Sets the max scroll offset of the source left edge in pixels.

void
setMaxScrollY(int maxScrollY)

This method is deprecated.

Use setMaxScrollY instead.

static void
setMaxScrollY(@NonNull AccessibilityRecord record, int maxScrollY)

Sets the max scroll offset of the source top edge in pixels.

void
setParcelableData(Parcelable parcelableData)

This method is deprecated.

Use setParcelableData directly.

void
setPassword(boolean isPassword)

This method is deprecated.

Use setPassword directly.

void
setRemovedCount(int removedCount)

This method is deprecated.

Use setRemovedCount directly.

void
setScrollX(int scrollX)

This method is deprecated.

Use setScrollX directly.

void
setScrollY(int scrollY)

This method is deprecated.

Use setScrollY directly.

void
setScrollable(boolean scrollable)

This method is deprecated.

Use setScrollable directly.

void
setSource(View source)

This method is deprecated.

Use setSource directly.

void
setSource(View root, int virtualDescendantId)

This method is deprecated.

Use setSource instead.

static void
setSource(
    @NonNull AccessibilityRecord record,
    @Nullable View root,
    int virtualDescendantId
)

Sets the source to be a virtual descendant of the given root.

void
setToIndex(int toIndex)

This method is deprecated.

Use setToIndex directly.

Public constructors

AccessibilityRecordCompat

Added in 1.1.0
Deprecated in 1.1.0
public AccessibilityRecordCompat(Object record)

Public methods

equals

Added in 1.1.0
Deprecated in 1.1.0
public boolean equals(Object obj)

getAddedCount

Added in 1.1.0
Deprecated in 1.1.0
public int getAddedCount()

Gets the number of added characters.

Returns
int

The number of added characters.

getBeforeText

Added in 1.1.0
Deprecated in 1.1.0
public CharSequence getBeforeText()

Sets the text before a change.

Returns
CharSequence

The text before the change.

getClassName

Added in 1.1.0
Deprecated in 1.1.0
public CharSequence getClassName()

Gets the class name of the source.

Returns
CharSequence

The class name.

getContentDescription

Added in 1.1.0
Deprecated in 1.1.0
public CharSequence getContentDescription()

Gets the description of the source.

Returns
CharSequence

The description.

getCurrentItemIndex

Added in 1.1.0
Deprecated in 1.1.0
public int getCurrentItemIndex()

Gets the index of the source in the list of items the can be visited.

Returns
int

The current item index.

getFromIndex

Added in 1.1.0
Deprecated in 1.1.0
public int getFromIndex()

Gets the index of the first character of the changed sequence, or the beginning of a text selection or the index of the first visible item when scrolling.

Returns
int

The index of the first character or selection start or the first visible item.

getImpl

Added in 1.1.0
Deprecated in 1.1.0
public Object getImpl()
Returns
Object

The wrapped implementation.

getItemCount

Added in 1.1.0
Deprecated in 1.1.0
public int getItemCount()

Gets the number of items that can be visited.

Returns
int

The number of items.

getMaxScrollX

Added in 1.1.0
Deprecated in 1.1.0
public int getMaxScrollX()

Gets the max scroll offset of the source left edge in pixels.

Returns
int

The max scroll.

getMaxScrollX

Added in 1.1.0
public static int getMaxScrollX(@NonNull AccessibilityRecord record)

Gets the max scroll offset of the source left edge in pixels.

Parameters
@NonNull AccessibilityRecord record

The AccessibilityRecord instance to use.

Returns
int

The max scroll.

getMaxScrollY

Added in 1.1.0
Deprecated in 1.1.0
public int getMaxScrollY()

Gets the max scroll offset of the source top edge in pixels.

Returns
int

The max scroll.

getMaxScrollY

Added in 1.1.0
public static int getMaxScrollY(@NonNull AccessibilityRecord record)

Gets the max scroll offset of the source top edge in pixels.

Parameters
@NonNull AccessibilityRecord record

The AccessibilityRecord instance to use.

Returns
int

The max scroll.

getParcelableData

Added in 1.1.0
Deprecated in 1.1.0
public Parcelable getParcelableData()

Gets the Parcelable data.

Returns
Parcelable

The parcelable data.

getRemovedCount

Added in 1.1.0
Deprecated in 1.1.0
public int getRemovedCount()

Gets the number of removed characters.

Returns
int

The number of removed characters.

getScrollX

Added in 1.1.0
Deprecated in 1.1.0
public int getScrollX()

Gets the scroll offset of the source left edge in pixels.

Returns
int

The scroll.

getScrollY

Added in 1.1.0
Deprecated in 1.1.0
public int getScrollY()

Gets the scroll offset of the source top edge in pixels.

Returns
int

The scroll.

getSource

Added in 1.1.0
Deprecated in 1.1.0
public AccessibilityNodeInfoCompat getSource()

Gets the AccessibilityNodeInfo of the event source.

Note: It is a client responsibility to recycle the received info by calling AccessibilityNodeInfo#recycle() to avoid creating of multiple instances.

Returns
AccessibilityNodeInfoCompat

The info of the source.

getText

Added in 1.1.0
Deprecated in 1.1.0
public List<CharSequencegetText()

Gets the text of the event. The index in the list represents the priority of the text. Specifically, the lower the index the higher the priority.

Returns
List<CharSequence>

The text.

getToIndex

Added in 1.1.0
Deprecated in 1.1.0
public int getToIndex()

Gets the index of text selection end or the index of the last visible item when scrolling.

Returns
int

The index of selection end or last item index.

getWindowId

Added in 1.1.0
Deprecated in 1.1.0
public int getWindowId()

Gets the id of the window from which the event comes from.

Returns
int

The window id.

hashCode

Added in 1.1.0
Deprecated in 1.1.0
public int hashCode()

isChecked

Added in 1.1.0
Deprecated in 1.1.0
public boolean isChecked()

Gets if the source is checked.

Returns
boolean

True if the view is checked, false otherwise.

isEnabled

Added in 1.1.0
Deprecated in 1.1.0
public boolean isEnabled()

Gets if the source is enabled.

Returns
boolean

True if the view is enabled, false otherwise.

isFullScreen

Added in 1.1.0
Deprecated in 1.1.0
public boolean isFullScreen()

Gets if the source is taking the entire screen.

Returns
boolean

True if the source is full screen, false otherwise.

isPassword

Added in 1.1.0
Deprecated in 1.1.0
public boolean isPassword()

Gets if the source is a password field.

Returns
boolean

True if the view is a password field, false otherwise.

isScrollable

Added in 1.1.0
Deprecated in 1.1.0
public boolean isScrollable()

Gets if the source is scrollable.

Returns
boolean

True if the source is scrollable, false otherwise.

obtain

Added in 1.1.0
Deprecated in 1.1.0
public static AccessibilityRecordCompat obtain()

Returns a cached instance if such is available or a new one is instantiated.

Returns
AccessibilityRecordCompat

An instance.

obtain

Added in 1.1.0
Deprecated in 1.1.0
public static AccessibilityRecordCompat obtain(AccessibilityRecordCompat record)

Returns a cached instance if such is available or a new one is instantiated. The instance is initialized with data from the given record.

Returns
AccessibilityRecordCompat

An instance.

recycle

Added in 1.1.0
Deprecated in 1.1.0
public void recycle()

Return an instance back to be reused.

Note: You must not touch the object after calling this function.

Throws
java.lang.IllegalStateException

If the record is already recycled.

setAddedCount

Added in 1.1.0
Deprecated in 1.1.0
public void setAddedCount(int addedCount)

Sets the number of added characters.

Parameters
int addedCount

The number of added characters.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setBeforeText

Added in 1.1.0
Deprecated in 1.1.0
public void setBeforeText(CharSequence beforeText)

Sets the text before a change.

Parameters
CharSequence beforeText

The text before the change.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setChecked

Added in 1.1.0
Deprecated in 1.1.0
public void setChecked(boolean isChecked)

Sets if the source is checked.

Parameters
boolean isChecked

True if the view is checked, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setClassName

Added in 1.1.0
Deprecated in 1.1.0
public void setClassName(CharSequence className)

Sets the class name of the source.

Parameters
CharSequence className

The lass name.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setContentDescription

Added in 1.1.0
Deprecated in 1.1.0
public void setContentDescription(CharSequence contentDescription)

Sets the description of the source.

Parameters
CharSequence contentDescription

The description.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setCurrentItemIndex

Added in 1.1.0
Deprecated in 1.1.0
public void setCurrentItemIndex(int currentItemIndex)

Sets the index of the source in the list of items that can be visited.

Parameters
int currentItemIndex

The current item index.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setEnabled

Added in 1.1.0
Deprecated in 1.1.0
public void setEnabled(boolean isEnabled)

Sets if the source is enabled.

Parameters
boolean isEnabled

True if the view is enabled, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setFromIndex

Added in 1.1.0
Deprecated in 1.1.0
public void setFromIndex(int fromIndex)

Sets the index of the first character of the changed sequence or the beginning of a text selection or the index of the first visible item when scrolling.

Parameters
int fromIndex

The index of the first character or selection start or the first visible item.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setFullScreen

Added in 1.1.0
Deprecated in 1.1.0
public void setFullScreen(boolean isFullScreen)

Sets if the source is taking the entire screen.

Parameters
boolean isFullScreen

True if the source is full screen, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setItemCount

Added in 1.1.0
Deprecated in 1.1.0
public void setItemCount(int itemCount)

Sets the number of items that can be visited.

Parameters
int itemCount

The number of items.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setMaxScrollX

Added in 1.1.0
Deprecated in 1.1.0
public void setMaxScrollX(int maxScrollX)

Sets the max scroll offset of the source left edge in pixels.

Parameters
int maxScrollX

The max scroll.

setMaxScrollX

Added in 1.1.0
public static void setMaxScrollX(@NonNull AccessibilityRecord record, int maxScrollX)

Sets the max scroll offset of the source left edge in pixels.

Parameters
@NonNull AccessibilityRecord record

The AccessibilityRecord instance to use.

int maxScrollX

The max scroll.

setMaxScrollY

Added in 1.1.0
Deprecated in 1.1.0
public void setMaxScrollY(int maxScrollY)

Sets the max scroll offset of the source top edge in pixels.

Parameters
int maxScrollY

The max scroll.

setMaxScrollY

Added in 1.1.0
public static void setMaxScrollY(@NonNull AccessibilityRecord record, int maxScrollY)

Sets the max scroll offset of the source top edge in pixels.

Parameters
@NonNull AccessibilityRecord record

The AccessibilityRecord instance to use.

int maxScrollY

The max scroll.

setParcelableData

Added in 1.1.0
Deprecated in 1.1.0
public void setParcelableData(Parcelable parcelableData)

Sets the Parcelable data of the event.

Parameters
Parcelable parcelableData

The parcelable data.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setPassword

Added in 1.1.0
Deprecated in 1.1.0
public void setPassword(boolean isPassword)

Sets if the source is a password field.

Parameters
boolean isPassword

True if the view is a password field, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setRemovedCount

Added in 1.1.0
Deprecated in 1.1.0
public void setRemovedCount(int removedCount)

Sets the number of removed characters.

Parameters
int removedCount

The number of removed characters.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setScrollX

Added in 1.1.0
Deprecated in 1.1.0
public void setScrollX(int scrollX)

Sets the scroll offset of the source left edge in pixels.

Parameters
int scrollX

The scroll.

setScrollY

Added in 1.1.0
Deprecated in 1.1.0
public void setScrollY(int scrollY)

Sets the scroll offset of the source top edge in pixels.

Parameters
int scrollY

The scroll.

setScrollable

Added in 1.1.0
Deprecated in 1.1.0
public void setScrollable(boolean scrollable)

Sets if the source is scrollable.

Parameters
boolean scrollable

True if the source is scrollable, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setSource

Added in 1.1.0
Deprecated in 1.1.0
public void setSource(View source)

Sets the event source.

Parameters
View source

The source.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setSource

Added in 1.1.0
Deprecated in 1.1.0
public void setSource(View root, int virtualDescendantId)

Sets the source to be a virtual descendant of the given root. If virtualDescendantId equals to NO_ID the root is set as the source.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.

Parameters
View root

The root of the virtual subtree.

int virtualDescendantId

The id of the virtual descendant.

setSource

Added in 1.1.0
public static void setSource(
    @NonNull AccessibilityRecord record,
    @Nullable View root,
    int virtualDescendantId
)

Sets the source to be a virtual descendant of the given root. If virtualDescendantId equals to NO_ID the root is set as the source.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.

Parameters
@NonNull AccessibilityRecord record

The AccessibilityRecord instance to use.

@Nullable View root

The root of the virtual subtree.

int virtualDescendantId

The id of the virtual descendant.

setToIndex

Added in 1.1.0
Deprecated in 1.1.0
public void setToIndex(int toIndex)

Sets the index of text selection end or the index of the last visible item when scrolling.

Parameters
int toIndex

The index of selection end or last item index.