AccessibilityRecordCompat
public
class
AccessibilityRecordCompat
extends Object
java.lang.Object | |
↳ | androidx.core.view.accessibility.AccessibilityRecordCompat |
Helper for accessing AccessibilityRecord
.
Summary
Public constructors | |
---|---|
AccessibilityRecordCompat(Object record)
This constructor is deprecated.
This is not type safe. If you want to modify an
|
Public methods | |
---|---|
boolean
|
equals(Object obj)
This method is deprecated.
Use |
int
|
getAddedCount()
This method is deprecated.
Use |
CharSequence
|
getBeforeText()
This method is deprecated.
Use |
CharSequence
|
getClassName()
This method is deprecated.
Use |
CharSequence
|
getContentDescription()
This method is deprecated.
Use |
int
|
getCurrentItemIndex()
This method is deprecated.
Use |
int
|
getFromIndex()
This method is deprecated.
Use |
Object
|
getImpl()
This method is deprecated. This method will be removed in a subsequent release of the support library. |
int
|
getItemCount()
This method is deprecated.
Use |
int
|
getMaxScrollX()
This method is deprecated.
Use |
static
int
|
getMaxScrollX(AccessibilityRecord record)
Gets the max scroll offset of the source left edge in pixels. |
int
|
getMaxScrollY()
This method is deprecated.
Use |
static
int
|
getMaxScrollY(AccessibilityRecord record)
Gets the max scroll offset of the source top edge in pixels. |
Parcelable
|
getParcelableData()
This method is deprecated.
Use |
int
|
getRemovedCount()
This method is deprecated.
Use |
int
|
getScrollX()
This method is deprecated.
Use |
int
|
getScrollY()
This method is deprecated.
Use |
AccessibilityNodeInfoCompat
|
getSource()
This method is deprecated.
Use |
List<CharSequence>
|
getText()
This method is deprecated.
Use |
int
|
getToIndex()
This method is deprecated.
Use |
int
|
getWindowId()
This method is deprecated.
Use |
int
|
hashCode()
This method is deprecated.
Use |
boolean
|
isChecked()
This method is deprecated.
Use |
boolean
|
isEnabled()
This method is deprecated.
Use |
boolean
|
isFullScreen()
This method is deprecated.
Use |
boolean
|
isPassword()
This method is deprecated.
Use |
boolean
|
isScrollable()
This method is deprecated.
Use |
static
AccessibilityRecordCompat
|
obtain(AccessibilityRecordCompat record)
This method is deprecated.
Use |
static
AccessibilityRecordCompat
|
obtain()
This method is deprecated.
Use |
void
|
recycle()
This method is deprecated.
Use |
void
|
setAddedCount(int addedCount)
This method is deprecated.
Use |
void
|
setBeforeText(CharSequence beforeText)
This method is deprecated.
Use |
void
|
setChecked(boolean isChecked)
This method is deprecated.
Use |
void
|
setClassName(CharSequence className)
This method is deprecated.
Use |
void
|
setContentDescription(CharSequence contentDescription)
This method is deprecated.
Use |
void
|
setCurrentItemIndex(int currentItemIndex)
This method is deprecated.
Use |
void
|
setEnabled(boolean isEnabled)
This method is deprecated.
Use |
void
|
setFromIndex(int fromIndex)
This method is deprecated.
Use |
void
|
setFullScreen(boolean isFullScreen)
This method is deprecated.
Use |
void
|
setItemCount(int itemCount)
This method is deprecated.
Use |
void
|
setMaxScrollX(int maxScrollX)
This method is deprecated.
Use |
static
void
|
setMaxScrollX(AccessibilityRecord record, int maxScrollX)
Sets the max scroll offset of the source left edge in pixels. |
static
void
|
setMaxScrollY(AccessibilityRecord record, int maxScrollY)
Sets the max scroll offset of the source top edge in pixels. |
void
|
setMaxScrollY(int maxScrollY)
This method is deprecated.
Use |
void
|
setParcelableData(Parcelable parcelableData)
This method is deprecated.
Use |
void
|
setPassword(boolean isPassword)
This method is deprecated.
Use |
void
|
setRemovedCount(int removedCount)
This method is deprecated.
Use |
void
|
setScrollX(int scrollX)
This method is deprecated.
Use |
void
|
setScrollY(int scrollY)
This method is deprecated.
Use |
void
|
setScrollable(boolean scrollable)
This method is deprecated.
Use |
void
|
setSource(View root, int virtualDescendantId)
This method is deprecated.
Use |
void
|
setSource(View source)
This method is deprecated.
Use |
static
void
|
setSource(AccessibilityRecord record, View root, int virtualDescendantId)
Sets the source to be a virtual descendant of the given |
void
|
setToIndex(int toIndex)
This method is deprecated.
Use |
Inherited methods | |
---|---|
Public constructors
AccessibilityRecordCompat
public AccessibilityRecordCompat (Object record)
This constructor is deprecated.
This is not type safe. If you want to modify an
AccessibilityEvent
's properties defined in
AccessibilityRecord
use
AccessibilityEventCompat.asRecord(AccessibilityEvent)
. This method will be removed
in a subsequent release of the support library.
Parameters | |
---|---|
record |
Object |
Public methods
equals
public boolean equals (Object obj)
This method is deprecated.
Use AccessibilityRecord
directly.
Parameters | |
---|---|
obj |
Object |
Returns | |
---|---|
boolean |
getAddedCount
public int getAddedCount ()
This method is deprecated.
Use AccessibilityRecord.getAddedCount()
directly.
Gets the number of added characters.
Returns | |
---|---|
int |
The number of added characters. |
getBeforeText
public CharSequence getBeforeText ()
This method is deprecated.
Use AccessibilityRecord.getBeforeText()
directly.
Sets the text before a change.
Returns | |
---|---|
CharSequence |
The text before the change. |
getClassName
public CharSequence getClassName ()
This method is deprecated.
Use AccessibilityRecord.getClassName()
directly.
Gets the class name of the source.
Returns | |
---|---|
CharSequence |
The class name. |
getContentDescription
public CharSequence getContentDescription ()
This method is deprecated.
Use AccessibilityRecord.getContentDescription()
directly.
Gets the description of the source.
Returns | |
---|---|
CharSequence |
The description. |
getCurrentItemIndex
public int getCurrentItemIndex ()
This method is deprecated.
Use AccessibilityRecord.getCurrentItemIndex()
directly.
Gets the index of the source in the list of items the can be visited.
Returns | |
---|---|
int |
The current item index. |
getFromIndex
public int getFromIndex ()
This method is 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.
Returns | |
---|---|
int |
The index of the first character or selection start or the first visible item. |
getImpl
public Object getImpl ()
This method is deprecated.
This method will be removed in a subsequent release of
the support library.
Returns | |
---|---|
Object |
The wrapped implementation. |
getItemCount
public int getItemCount ()
This method is deprecated.
Use AccessibilityRecord.getItemCount()
directly.
Gets the number of items that can be visited.
Returns | |
---|---|
int |
The number of items. |
getMaxScrollX
public int getMaxScrollX ()
This method is deprecated.
Use getMaxScrollX(AccessibilityRecord)
instead.
Gets the max scroll offset of the source left edge in pixels.
Returns | |
---|---|
int |
The max scroll. |
getMaxScrollX
public static int getMaxScrollX (AccessibilityRecord record)
Gets the max scroll offset of the source left edge in pixels.
Parameters | |
---|---|
record |
AccessibilityRecord : The AccessibilityRecord instance to use. |
Returns | |
---|---|
int |
The max scroll. |
getMaxScrollY
public int getMaxScrollY ()
This method is deprecated.
Use getMaxScrollY(AccessibilityRecord)
instead.
Gets the max scroll offset of the source top edge in pixels.
Returns | |
---|---|
int |
The max scroll. |
getMaxScrollY
public static int getMaxScrollY (AccessibilityRecord record)
Gets the max scroll offset of the source top edge in pixels.
Parameters | |
---|---|
record |
AccessibilityRecord : The AccessibilityRecord instance to use. |
Returns | |
---|---|
int |
The max scroll. |
getParcelableData
public Parcelable getParcelableData ()
This method is deprecated.
Use AccessibilityRecord.getParcelableData()
directly.
Gets the Parcelable
data.
Returns | |
---|---|
Parcelable |
The parcelable data. |
getRemovedCount
public int getRemovedCount ()
This method is deprecated.
Use AccessibilityRecord.getRemovedCount()
directly.
Gets the number of removed characters.
Returns | |
---|---|
int |
The number of removed characters. |
getScrollX
public int getScrollX ()
This method is deprecated.
Use AccessibilityRecord.getScrollX()
directly.
Gets the scroll offset of the source left edge in pixels.
Returns | |
---|---|
int |
The scroll. |
getScrollY
public int getScrollY ()
This method is deprecated.
Use AccessibilityRecord.getScrollY()
directly.
Gets the scroll offset of the source top edge in pixels.
Returns | |
---|---|
int |
The scroll. |
getSource
public AccessibilityNodeInfoCompat getSource ()
This method is deprecated.
Use AccessibilityRecord.getSource()
directly.
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
public List<CharSequence> getText ()
This method is 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.
Returns | |
---|---|
List<CharSequence> |
The text. |
getToIndex
public int getToIndex ()
This method is deprecated.
Use AccessibilityRecord.getToIndex()
directly.
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
public int getWindowId ()
This method is deprecated.
Use AccessibilityRecord.getWindowId()
directly.
Gets the id of the window from which the event comes from.
Returns | |
---|---|
int |
The window id. |
hashCode
public int hashCode ()
This method is deprecated.
Use Object.hashCode()
directly.
Returns | |
---|---|
int |
isChecked
public boolean isChecked ()
This method is deprecated.
Use AccessibilityRecord.isChecked()
directly.
Gets if the source is checked.
Returns | |
---|---|
boolean |
True if the view is checked, false otherwise. |
isEnabled
public boolean isEnabled ()
This method is deprecated.
Use AccessibilityRecord.isEnabled()
directly.
Gets if the source is enabled.
Returns | |
---|---|
boolean |
True if the view is enabled, false otherwise. |
isFullScreen
public boolean isFullScreen ()
This method is deprecated.
Use AccessibilityRecord.isFullScreen()
directly.
Gets if the source is taking the entire screen.
Returns | |
---|---|
boolean |
True if the source is full screen, false otherwise. |
isPassword
public boolean isPassword ()
This method is deprecated.
Use AccessibilityRecord.isPassword()
directly.
Gets if the source is a password field.
Returns | |
---|---|
boolean |
True if the view is a password field, false otherwise. |
isScrollable
public boolean isScrollable ()
This method is deprecated.
Use AccessibilityRecord.isScrollable()
directly.
Gets if the source is scrollable.
Returns | |
---|---|
boolean |
True if the source is scrollable, false otherwise. |
obtain
public static AccessibilityRecordCompat obtain (AccessibilityRecordCompat record)
This method is 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.
Parameters | |
---|---|
record |
AccessibilityRecordCompat |
Returns | |
---|---|
AccessibilityRecordCompat |
An instance. |
obtain
public static AccessibilityRecordCompat obtain ()
This method is deprecated.
Use AccessibilityRecord.obtain()
directly.
Returns a cached instance if such is available or a new one is instantiated.
Returns | |
---|---|
AccessibilityRecordCompat |
An instance. |
recycle
public void recycle ()
This method is deprecated.
Use AccessibilityRecord.recycle()
directly.
Return an instance back to be reused.
Note: You must not touch the object after calling this function.
Throws | |
---|---|
IllegalStateException |
If the record is already recycled. |
setAddedCount
public void setAddedCount (int addedCount)
This method is deprecated.
Use AccessibilityRecord.setAddedCount(int)
directly.
Sets the number of added characters.
Parameters | |
---|---|
addedCount |
int : The number of added characters. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setBeforeText
public void setBeforeText (CharSequence beforeText)
This method is deprecated.
Use AccessibilityRecord.setBeforeText(CharSequence)
directly.
Sets the text before a change.
Parameters | |
---|---|
beforeText |
CharSequence : The text before the change. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setChecked
public void setChecked (boolean isChecked)
This method is deprecated.
Use AccessibilityRecord.setChecked(boolean)
directly.
Sets if the source is checked.
Parameters | |
---|---|
isChecked |
boolean : True if the view is checked, false otherwise. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setClassName
public void setClassName (CharSequence className)
This method is deprecated.
Use AccessibilityRecord.setClassName(CharSequence)
directly.
Sets the class name of the source.
Parameters | |
---|---|
className |
CharSequence : The lass name. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setContentDescription
public void setContentDescription (CharSequence contentDescription)
This method is deprecated.
Use AccessibilityRecord.setContentDescription(CharSequence)
directly.
Sets the description of the source.
Parameters | |
---|---|
contentDescription |
CharSequence : The description. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setCurrentItemIndex
public void setCurrentItemIndex (int currentItemIndex)
This method is 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. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setEnabled
public void setEnabled (boolean isEnabled)
This method is deprecated.
Use AccessibilityRecord.isEnabled()
directly.
Sets if the source is enabled.
Parameters | |
---|---|
isEnabled |
boolean : True if the view is enabled, false otherwise. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setFromIndex
public void setFromIndex (int fromIndex)
This method is 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. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setFullScreen
public void setFullScreen (boolean isFullScreen)
This method is 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. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setItemCount
public void setItemCount (int itemCount)
This method is deprecated.
Use AccessibilityRecord.setItemCount(int)
directly.
Sets the number of items that can be visited.
Parameters | |
---|---|
itemCount |
int : The number of items. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setMaxScrollX
public void setMaxScrollX (int maxScrollX)
This method is 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
public static void setMaxScrollX (AccessibilityRecord record, int maxScrollX)
Sets the max scroll offset of the source left edge in pixels.
Parameters | |
---|---|
record |
AccessibilityRecord : The AccessibilityRecord instance to use. |
maxScrollX |
int : The max scroll.
|
setMaxScrollY
public static void setMaxScrollY (AccessibilityRecord record, int maxScrollY)
Sets the max scroll offset of the source top edge in pixels.
Parameters | |
---|---|
record |
AccessibilityRecord : The AccessibilityRecord instance to use. |
maxScrollY |
int : The max scroll.
|
setMaxScrollY
public void setMaxScrollY (int maxScrollY)
This method is deprecated.
Use setMaxScrollY(AccessibilityRecord, int)
instead.
Sets the max scroll offset of the source top edge in pixels.
Parameters | |
---|---|
maxScrollY |
int : The max scroll. |
setParcelableData
public void setParcelableData (Parcelable parcelableData)
This method is deprecated.
Use AccessibilityRecord.setParcelableData(Parcelable)
directly.
Sets the Parcelable
data of the event.
Parameters | |
---|---|
parcelableData |
Parcelable : The parcelable data. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setPassword
public void setPassword (boolean isPassword)
This method is 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. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setRemovedCount
public void setRemovedCount (int removedCount)
This method is deprecated.
Use AccessibilityRecord.setRemovedCount(int)
directly.
Sets the number of removed characters.
Parameters | |
---|---|
removedCount |
int : The number of removed characters. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setScrollX
public void setScrollX (int scrollX)
This method is deprecated.
Use AccessibilityRecord.setScrollX(int)
directly.
Sets the scroll offset of the source left edge in pixels.
Parameters | |
---|---|
scrollX |
int : The scroll. |
setScrollY
public void setScrollY (int scrollY)
This method is deprecated.
Use AccessibilityRecord.setScrollY(int)
directly.
Sets the scroll offset of the source top edge in pixels.
Parameters | |
---|---|
scrollY |
int : The scroll. |
setScrollable
public void setScrollable (boolean scrollable)
This method is deprecated.
Use AccessibilityRecord.setScrollable(boolean)
directly.
Sets if the source is scrollable.
Parameters | |
---|---|
scrollable |
boolean : True if the source is scrollable, false otherwise. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setSource
public void setSource (View root, int virtualDescendantId)
This method is 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 |
int : The id of the virtual descendant. |
setSource
public void setSource (View source)
This method is deprecated.
Use AccessibilityRecord.setSource(View)
directly.
Sets the event source.
Parameters | |
---|---|
source |
View : The source. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setSource
public static void setSource (AccessibilityRecord record, View root, int virtualDescendantId)
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 |
View : The root of the virtual subtree. |
virtualDescendantId |
int : The id of the virtual descendant.
|
setToIndex
public void setToIndex (int toIndex)
This method is 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. |