AccessibilityRecordCompat
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 |
int |
This method is deprecated. Use |
CharSequence |
This method is deprecated. Use |
CharSequence |
This method is deprecated. Use |
CharSequence |
This method is deprecated. Use |
int |
This method is deprecated. Use |
int |
This method is deprecated. Use |
Object |
This method is deprecated. This method will be removed in a subsequent release of the support library. |
int |
This method is deprecated. Use |
int |
This method is deprecated. Use |
static int |
@ReplaceWith(expression = "record.getMaxScrollX()")This method is deprecated. Call |
int |
This method is deprecated. Use |
static int |
@ReplaceWith(expression = "record.getMaxScrollY()")This method is deprecated. Call |
Parcelable |
This method is deprecated. Use |
int |
This method is deprecated. Use |
int |
This method is deprecated. Use |
int |
This method is deprecated. Use |
AccessibilityNodeInfoCompat |
This method is deprecated. Use |
List<CharSequence> |
This method is deprecated. Use |
int |
This method is deprecated. Use |
int |
This method is deprecated. Use |
int |
This method is deprecated. Use |
boolean |
This method is deprecated. Use |
boolean |
This method is deprecated. Use |
boolean |
This method is deprecated. Use |
boolean |
This method is deprecated. Use |
boolean |
This method is deprecated. Use |
static AccessibilityRecordCompat |
This method is deprecated. Use |
static AccessibilityRecordCompat |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
static void |
@ReplaceWith(expression = "record.setMaxScrollX(maxScrollX)")This method is deprecated. Call setMaxScrollX directly. |
void |
This method is deprecated. Use |
static void |
@ReplaceWith(expression = "record.setMaxScrollY(maxScrollY)")This method is deprecated. Call setMaxScrollY directly. |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
void |
This method is deprecated. Use |
static void |
@ReplaceWith(expression = "record.setSource(root, virtualDescendantId)")This method is deprecated. Call setSource directly. |
void |
This method is deprecated. Use |
Public constructors
Public methods
public int getAddedCount()Gets the number of added characters.
| Returns | |
|---|---|
int |
The number of added characters. |
public CharSequencegetBeforeText()
Sets the text before a change.
| Returns | |
|---|---|
CharSequence |
The text before the change. |
public CharSequencegetClassName()
Gets the class name of the source.
| Returns | |
|---|---|
CharSequence |
The class name. |
public CharSequencegetContentDescription()
Gets the description of the source.
| Returns | |
|---|---|
CharSequence |
The description. |
public int getCurrentItemIndex()Gets the index of the source in the list of items the can be visited.
| Returns | |
|---|---|
int |
The current item index. |
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. |
public int getItemCount()Gets the number of items that can be visited.
| Returns | |
|---|---|
int |
The number of items. |
public int getMaxScrollX()Gets the max scroll offset of the source left edge in pixels.
| Returns | |
|---|---|
int |
The max scroll. |
@ReplaceWith(expression = "record.getMaxScrollX()")
public static intgetMaxScrollX(@NonNull AccessibilityRecord record)
Gets the max scroll offset of the source left edge in pixels.
| Parameters | |
|---|---|
@NonNull AccessibilityRecord record |
The |
| Returns | |
|---|---|
int |
The max scroll. |
public int getMaxScrollY()Gets the max scroll offset of the source top edge in pixels.
| Returns | |
|---|---|
int |
The max scroll. |
@ReplaceWith(expression = "record.getMaxScrollY()")
public static intgetMaxScrollY(@NonNull AccessibilityRecord record)
Gets the max scroll offset of the source top edge in pixels.
| Parameters | |
|---|---|
@NonNull AccessibilityRecord record |
The |
| Returns | |
|---|---|
int |
The max scroll. |
public ParcelablegetParcelableData()
Gets the Parcelable data.
| Returns | |
|---|---|
Parcelable |
The parcelable data. |
public int getRemovedCount()Gets the number of removed characters.
| Returns | |
|---|---|
int |
The number of removed characters. |
public int getScrollX()Gets the scroll offset of the source left edge in pixels.
| Returns | |
|---|---|
int |
The scroll. |
public int getScrollY()Gets the scroll offset of the source top edge in pixels.
| Returns | |
|---|---|
int |
The scroll. |
public AccessibilityNodeInfoCompatgetSource()
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. |
public List<CharSequence>getText()
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. |
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. |
public int getWindowId()Gets the id of the window from which the event comes from.
| Returns | |
|---|---|
int |
The window id. |
public boolean isChecked()Gets if the source is checked.
| Returns | |
|---|---|
boolean |
True if the view is checked, false otherwise. |
public boolean isEnabled()Gets if the source is enabled.
| Returns | |
|---|---|
boolean |
True if the view is enabled, false otherwise. |
public boolean isFullScreen()Gets if the source is taking the entire screen.
| Returns | |
|---|---|
boolean |
True if the source is full screen, false otherwise. |
public boolean isPassword()Gets if the source is a password field.
| Returns | |
|---|---|
boolean |
True if the view is a password field, false otherwise. |
public boolean isScrollable()Gets if the source is scrollable.
| Returns | |
|---|---|
boolean |
True if the source is scrollable, false otherwise. |
public static AccessibilityRecordCompatobtain()
Returns a cached instance if such is available or a new one is instantiated.
| Returns | |
|---|---|
AccessibilityRecordCompat |
An instance. |
public static AccessibilityRecordCompatobtain(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. |
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. |
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. |
public voidsetBeforeText(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. |
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. |
public voidsetClassName(CharSequence className)
Sets the class name of the source.
| Parameters | |
|---|---|
CharSequence className |
The lass name. |
| Throws | |
|---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
public voidsetContentDescription(CharSequence contentDescription)
Sets the description of the source.
| Parameters | |
|---|---|
CharSequence contentDescription |
The description. |
| Throws | |
|---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
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. |
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. |
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. |
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. |
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. |
public void setMaxScrollX(int maxScrollX)Sets the max scroll offset of the source left edge in pixels.
| Parameters | |
|---|---|
int maxScrollX |
The max scroll. |
@ReplaceWith(expression = "record.setMaxScrollX(maxScrollX)")
public static voidsetMaxScrollX(@NonNull AccessibilityRecord record, int maxScrollX)
Sets the max scroll offset of the source left edge in pixels.
| Parameters | |
|---|---|
@NonNull AccessibilityRecord record |
The |
int maxScrollX |
The max scroll. |
public void setMaxScrollY(int maxScrollY)Sets the max scroll offset of the source top edge in pixels.
| Parameters | |
|---|---|
int maxScrollY |
The max scroll. |
@ReplaceWith(expression = "record.setMaxScrollY(maxScrollY)")
public static voidsetMaxScrollY(@NonNull AccessibilityRecord record, int maxScrollY)
Sets the max scroll offset of the source top edge in pixels.
| Parameters | |
|---|---|
@NonNull AccessibilityRecord record |
The |
int maxScrollY |
The max scroll. |
public voidsetParcelableData(Parcelable parcelableData)
Sets the Parcelable data of the event.
| Parameters | |
|---|---|
Parcelable parcelableData |
The parcelable data. |
| Throws | |
|---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
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. |
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. |
public void setScrollX(int scrollX)Sets the scroll offset of the source left edge in pixels.
| Parameters | |
|---|---|
int scrollX |
The scroll. |
public void setScrollY(int scrollY)Sets the scroll offset of the source top edge in pixels.
| Parameters | |
|---|---|
int scrollY |
The scroll. |
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. |
public voidsetSource(View source)
Sets the event source.
| Parameters | |
|---|---|
View source |
The source. |
| Throws | |
|---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
public voidsetSource(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. |
@ReplaceWith(expression = "record.setSource(root, virtualDescendantId)")
public static voidsetSource(
@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 |
@Nullable View root |
The root of the virtual subtree. |
int virtualDescendantId |
The id of the virtual descendant. |
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. |