Register now for Android Dev Summit 2019!

AccessibilityRecordCompat

open class AccessibilityRecordCompat
kotlin.Any
   ↳ androidx.core.view.accessibility.AccessibilityRecordCompat

Helper for accessing AccessibilityRecord.

Summary

Public constructors

<init>(record: Any!)

Public methods

open Boolean
equals(other: Any?)

open Int

Gets the number of added characters.

open CharSequence!

Sets the text before a change.

open CharSequence!

Gets the class name of the source.

open CharSequence!

Gets the description of the source.

open Int

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

open Int

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.

open Any!

open Int

Gets the number of items that can be visited.

open Int

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

open static Int

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

open Int

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

open static Int

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

open Parcelable!

Gets the Parcelable data.

open Int

Gets the number of removed characters.

open Int

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

open Int

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

open AccessibilityNodeInfoCompat!

Gets the android.view.accessibility.AccessibilityNodeInfo of the event source.

open MutableList<CharSequence!>!

Gets the text of the event.

open Int

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

open Int

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

open Int

open Boolean

Gets if the source is checked.

open Boolean

Gets if the source is enabled.

open Boolean

Gets if the source is taking the entire screen.

open Boolean

Gets if the source is a password field.

open Boolean

Gets if the source is scrollable.

open static AccessibilityRecordCompat!

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

open static AccessibilityRecordCompat!

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

open Unit

Return an instance back to be reused.

open Unit
setAddedCount(addedCount: Int)

Sets the number of added characters.

open Unit

Sets the text before a change.

open Unit
setChecked(isChecked: Boolean)

Sets if the source is checked.

open Unit

Sets the class name of the source.

open Unit
setContentDescription(contentDescription: CharSequence!)

Sets the description of the source.

open Unit
setCurrentItemIndex(currentItemIndex: Int)

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

open Unit
setEnabled(isEnabled: Boolean)

Sets if the source is enabled.

open Unit
setFromIndex(fromIndex: Int)

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.

open Unit
setFullScreen(isFullScreen: Boolean)

Sets if the source is taking the entire screen.

open Unit
setItemCount(itemCount: Int)

Sets the number of items that can be visited.

open Unit
setMaxScrollX(maxScrollX: Int)

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

open static Unit
setMaxScrollX(record: AccessibilityRecord!, maxScrollX: Int)

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

open Unit
setMaxScrollY(maxScrollY: Int)

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

open static Unit
setMaxScrollY(record: AccessibilityRecord!, maxScrollY: Int)

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

open Unit
setParcelableData(parcelableData: Parcelable!)

Sets the Parcelable data of the event.

open Unit
setPassword(isPassword: Boolean)

Sets if the source is a password field.

open Unit
setRemovedCount(removedCount: Int)

Sets the number of removed characters.

open Unit
setScrollX(scrollX: Int)

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

open Unit
setScrollY(scrollY: Int)

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

open Unit
setScrollable(scrollable: Boolean)

Sets if the source is scrollable.

open Unit
setSource(source: View!)

Sets the event source.

open Unit
setSource(root: View!, virtualDescendantId: Int)

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

open static Unit
setSource(@NonNull record: AccessibilityRecord, root: View!, virtualDescendantId: Int)

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

open Unit
setToIndex(toIndex: Int)

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

Public constructors

<init>

AccessibilityRecordCompat(record: Any!)

Deprecated: This is not type safe. If you want to modify an AccessibilityEvent's properties defined in android.view.accessibility.AccessibilityRecord use AccessibilityEventCompat#asRecord(AccessibilityEvent). This method will be removed in a subsequent release of the support library.

Public methods

equals

open fun equals(other: Any?): Boolean

Deprecated: Use AccessibilityRecord directly.

getAddedCount

open fun getAddedCount(): Int

Deprecated: Use AccessibilityRecord#getAddedCount() directly.

Gets the number of added characters.

Return
Int: The number of added characters.

getBeforeText

open fun getBeforeText(): CharSequence!

Deprecated: Use AccessibilityRecord#getBeforeText() directly.

Sets the text before a change.

Return
CharSequence!: The text before the change.

getClassName

open fun getClassName(): CharSequence!

Deprecated: Use AccessibilityRecord#getClassName() directly.

Gets the class name of the source.

Return
CharSequence!: The class name.

getContentDescription

open fun getContentDescription(): CharSequence!

Deprecated: Use AccessibilityRecord#getContentDescription() directly.

Gets the description of the source.

Return
CharSequence!: The description.

getCurrentItemIndex

open fun getCurrentItemIndex(): Int

Deprecated: Use AccessibilityRecord#getCurrentItemIndex() directly.

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

Return
Int: The current item index.

getFromIndex

open fun getFromIndex(): Int

Deprecated: Use AccessibilityRecord#getFromIndex() directly.

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.

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

getImpl

open fun getImpl(): Any!

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

Return
Any!: The wrapped implementation.

getItemCount

open fun getItemCount(): Int

Deprecated: Use AccessibilityRecord#getItemCount() directly.

Gets the number of items that can be visited.

Return
Int: The number of items.

getMaxScrollX

open fun getMaxScrollX(): Int

Deprecated: Use getMaxScrollX(AccessibilityRecord) instead.

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

Return
Int: The max scroll.

getMaxScrollX

open static fun getMaxScrollX(record: AccessibilityRecord!): Int

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

Parameters
record AccessibilityRecord!: The AccessibilityRecord instance to use.
Return
Int: The max scroll.

getMaxScrollY

open fun getMaxScrollY(): Int

Deprecated: Use getMaxScrollY(AccessibilityRecord) instead.

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

Return
Int: The max scroll.

getMaxScrollY

open static fun getMaxScrollY(record: AccessibilityRecord!): Int

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

Parameters
record AccessibilityRecord!: The AccessibilityRecord instance to use.
Return
Int: The max scroll.

getParcelableData

open fun getParcelableData(): Parcelable!

Deprecated: Use AccessibilityRecord#getParcelableData() directly.

Gets the Parcelable data.

Return
Parcelable!: The parcelable data.

getRemovedCount

open fun getRemovedCount(): Int

Deprecated: Use AccessibilityRecord#getRemovedCount() directly.

Gets the number of removed characters.

Return
Int: The number of removed characters.

getScrollX

open fun getScrollX(): Int

Deprecated: Use AccessibilityRecord#getScrollX() directly.

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

Return
Int: The scroll.

getScrollY

open fun getScrollY(): Int

Deprecated: Use AccessibilityRecord#getScrollY() directly.

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

Return
Int: The scroll.

getSource

open fun getSource(): AccessibilityNodeInfoCompat!

Deprecated: Use AccessibilityRecord#getSource() directly.

Gets the android.view.accessibility.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.

Return
AccessibilityNodeInfoCompat!: The info of the source.

getText

open fun getText(): MutableList<CharSequence!>!

Deprecated: Use AccessibilityRecord#getText() directly.

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.

Return
MutableList<CharSequence!>!: The text.

getToIndex

open fun getToIndex(): Int

Deprecated: Use AccessibilityRecord#getToIndex() directly.

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

Return
Int: The index of selection end or last item index.

getWindowId

open fun getWindowId(): Int

Deprecated: Use AccessibilityRecord#getWindowId() directly.

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

Return
Int: The window id.

hashCode

open fun hashCode(): Int

Deprecated: Use AccessibilityRecord#hashCode() directly.

isChecked

open fun isChecked(): Boolean

Deprecated: Use AccessibilityRecord#isChecked() directly.

Gets if the source is checked.

Return
Boolean: True if the view is checked, false otherwise.

isEnabled

open fun isEnabled(): Boolean

Deprecated: Use AccessibilityRecord#isEnabled() directly.

Gets if the source is enabled.

Return
Boolean: True if the view is enabled, false otherwise.

isFullScreen

open fun isFullScreen(): Boolean

Deprecated: Use AccessibilityRecord#isFullScreen() directly.

Gets if the source is taking the entire screen.

Return
Boolean: True if the source is full screen, false otherwise.

isPassword

open fun isPassword(): Boolean

Deprecated: Use AccessibilityRecord#isPassword() directly.

Gets if the source is a password field.

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

isScrollable

open fun isScrollable(): Boolean

Deprecated: Use AccessibilityRecord#isScrollable() directly.

Gets if the source is scrollable.

Return
Boolean: True if the source is scrollable, false otherwise.

obtain

open static fun obtain(record: AccessibilityRecordCompat!): AccessibilityRecordCompat!

Deprecated: Use AccessibilityRecord#obtain(AccessibilityRecord) directly.

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

Return
AccessibilityRecordCompat!: An instance.

obtain

open static fun obtain(): AccessibilityRecordCompat!

Deprecated: Use AccessibilityRecord#obtain() directly.

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

Return
AccessibilityRecordCompat!: An instance.

recycle

open fun recycle(): Unit

Deprecated: Use AccessibilityRecord#recycle() directly.

Return an instance back to be reused.

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

Exceptions
IllegalStateException If the record is already recycled.

setAddedCount

open fun setAddedCount(addedCount: Int): Unit

Deprecated: Use AccessibilityRecord#setAddedCount(int) directly.

Sets the number of added characters.

Parameters
addedCount Int: The number of added characters.
Exceptions
IllegalStateException If called from an AccessibilityService.

setBeforeText

open fun setBeforeText(beforeText: CharSequence!): Unit

Deprecated: Use AccessibilityRecord#setBeforeText(CharSequence) directly.

Sets the text before a change.

Parameters
beforeText CharSequence!: The text before the change.
Exceptions
IllegalStateException If called from an AccessibilityService.

setChecked

open fun setChecked(isChecked: Boolean): Unit

Deprecated: Use AccessibilityRecord#setChecked(boolean) directly.

Sets if the source is checked.

Parameters
isChecked Boolean: True if the view is checked, false otherwise.
Exceptions
IllegalStateException If called from an AccessibilityService.

setClassName

open fun setClassName(className: CharSequence!): Unit

Deprecated: Use AccessibilityRecord#setClassName(CharSequence) directly.

Sets the class name of the source.

Parameters
className CharSequence!: The lass name.
Exceptions
IllegalStateException If called from an AccessibilityService.

setContentDescription

open fun setContentDescription(contentDescription: CharSequence!): Unit

Deprecated: Use AccessibilityRecord#setContentDescription(CharSequence) directly.

Sets the description of the source.

Parameters
contentDescription CharSequence!: The description.
Exceptions
IllegalStateException If called from an AccessibilityService.

setCurrentItemIndex

open fun setCurrentItemIndex(currentItemIndex: Int): Unit

Deprecated: Use AccessibilityRecord#setCurrentItemIndex(int) directly.

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

Parameters
currentItemIndex Int: The current item index.
Exceptions
IllegalStateException If called from an AccessibilityService.

setEnabled

open fun setEnabled(isEnabled: Boolean): Unit

Deprecated: Use AccessibilityRecord#isEnabled() directly.

Sets if the source is enabled.

Parameters
isEnabled Boolean: True if the view is enabled, false otherwise.
Exceptions
IllegalStateException If called from an AccessibilityService.

setFromIndex

open fun setFromIndex(fromIndex: Int): Unit

Deprecated: Use AccessibilityRecord#setFromIndex(int) directly.

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
fromIndex Int: The index of the first character or selection start or the first visible item.
Exceptions
IllegalStateException If called from an AccessibilityService.

setFullScreen

open fun setFullScreen(isFullScreen: Boolean): Unit

Deprecated: Use AccessibilityRecord#setFullScreen(boolean) directly.

Sets if the source is taking the entire screen.

Parameters
isFullScreen Boolean: True if the source is full screen, false otherwise.
Exceptions
IllegalStateException If called from an AccessibilityService.

setItemCount

open fun setItemCount(itemCount: Int): Unit

Deprecated: Use AccessibilityRecord#setItemCount(int) directly.

Sets the number of items that can be visited.

Parameters
itemCount Int: The number of items.
Exceptions
IllegalStateException If called from an AccessibilityService.

setMaxScrollX

open fun setMaxScrollX(maxScrollX: Int): Unit

Deprecated: Use setMaxScrollX(AccessibilityRecord, int) instead.

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

Parameters
maxScrollX Int: The max scroll.

setMaxScrollX

open static fun setMaxScrollX(record: AccessibilityRecord!, maxScrollX: Int): Unit

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

Parameters
record AccessibilityRecord!: The AccessibilityRecord instance to use.
maxScrollX AccessibilityRecord!: The max scroll.

setMaxScrollY

open fun setMaxScrollY(maxScrollY: Int): Unit

Deprecated: Use setMaxScrollY(AccessibilityRecord, int) instead.

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

Parameters
maxScrollY Int: The max scroll.

setMaxScrollY

open static fun setMaxScrollY(record: AccessibilityRecord!, maxScrollY: Int): Unit

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

Parameters
record AccessibilityRecord!: The AccessibilityRecord instance to use.
maxScrollY AccessibilityRecord!: The max scroll.

setParcelableData

open fun setParcelableData(parcelableData: Parcelable!): Unit

Deprecated: Use AccessibilityRecord#setParcelableData(Parcelable) directly.

Sets the Parcelable data of the event.

Parameters
parcelableData Parcelable!: The parcelable data.
Exceptions
IllegalStateException If called from an AccessibilityService.

setPassword

open fun setPassword(isPassword: Boolean): Unit

Deprecated: Use AccessibilityRecord#setPassword(boolean) directly.

Sets if the source is a password field.

Parameters
isPassword Boolean: True if the view is a password field, false otherwise.
Exceptions
IllegalStateException If called from an AccessibilityService.

setRemovedCount

open fun setRemovedCount(removedCount: Int): Unit

Deprecated: Use AccessibilityRecord#setRemovedCount(int) directly.

Sets the number of removed characters.

Parameters
removedCount Int: The number of removed characters.
Exceptions
IllegalStateException If called from an AccessibilityService.

setScrollX

open fun setScrollX(scrollX: Int): Unit

Deprecated: Use AccessibilityRecord#setScrollX(int) directly.

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

Parameters
scrollX Int: The scroll.

setScrollY

open fun setScrollY(scrollY: Int): Unit

Deprecated: Use AccessibilityRecord#setScrollY(int) directly.

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

Parameters
scrollY Int: The scroll.

setScrollable

open fun setScrollable(scrollable: Boolean): Unit

Deprecated: Use AccessibilityRecord#setScrollable(boolean) directly.

Sets if the source is scrollable.

Parameters
scrollable Boolean: True if the source is scrollable, false otherwise.
Exceptions
IllegalStateException If called from an AccessibilityService.

setSource

open fun setSource(source: View!): Unit

Deprecated: Use AccessibilityRecord#setSource(View) directly.

Sets the event source.

Parameters
source View!: The source.
Exceptions
IllegalStateException If called from an AccessibilityService.

setSource

open fun setSource(root: View!, virtualDescendantId: Int): Unit

Deprecated: Use setSource(AccessibilityRecord, View, int) instead.

Sets the source to be a virtual descendant of the given root. If virtualDescendantId equals to View#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
root View!: The root of the virtual subtree.
virtualDescendantId View!: The id of the virtual descendant.

setSource

open static fun setSource(@NonNull record: AccessibilityRecord, root: View!, virtualDescendantId: Int): Unit

Sets the source to be a virtual descendant of the given root. If virtualDescendantId equals to View#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
record AccessibilityRecord: The AccessibilityRecord instance to use.
root AccessibilityRecord: The root of the virtual subtree.
virtualDescendantId AccessibilityRecord: The id of the virtual descendant.

setToIndex

open fun setToIndex(toIndex: Int): Unit

Deprecated: Use AccessibilityRecord#setToIndex(int) directly.

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

Parameters
toIndex Int: The index of selection end or last item index.