public
class
AccessibilityRecordCompat
extends Object
java.lang.Object | |
↳ | android.support.v4.view.accessibility.AccessibilityRecordCompat |
Helper for accessing AccessibilityRecord
introduced after API level 4 in a backwards compatible fashion.
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)
Indicates whether some other object is "equal to" this one. |
int
|
getAddedCount()
Gets the number of added characters. |
CharSequence
|
getBeforeText()
Sets the text before a change. |
CharSequence
|
getClassName()
Gets the class name of the source. |
CharSequence
|
getContentDescription()
Gets the description of the source. |
int
|
getCurrentItemIndex()
Gets the index of the source in the list of items the can be visited. |
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. |
Object
|
getImpl()
This method is deprecated. This method will be removed in a subsequent release of the support library. |
int
|
getItemCount()
Gets the number of items that can be visited. |
int
|
getMaxScrollX()
Gets the max scroll offset of the source left edge in pixels. |
int
|
getMaxScrollY()
Gets the max scroll offset of the source top edge in pixels. |
Parcelable
|
getParcelableData()
Gets the |
int
|
getRemovedCount()
Gets the number of removed characters. |
int
|
getScrollX()
Gets the scroll offset of the source left edge in pixels. |
int
|
getScrollY()
Gets the scroll offset of the source top edge in pixels. |
AccessibilityNodeInfoCompat
|
getSource()
Gets the |
List<CharSequence>
|
getText()
Gets the text of the event. |
int
|
getToIndex()
Gets the index of text selection end or the index of the last visible item when scrolling. |
int
|
getWindowId()
Gets the id of the window from which the event comes from. |
int
|
hashCode()
Returns a hash code value for the object. |
boolean
|
isChecked()
Gets if the source is checked. |
boolean
|
isEnabled()
Gets if the source is enabled. |
boolean
|
isFullScreen()
Gets if the source is taking the entire screen. |
boolean
|
isPassword()
Gets if the source is a password field. |
boolean
|
isScrollable()
Gets if the source is scrollable. |
static
AccessibilityRecordCompat
|
obtain(AccessibilityRecordCompat record)
Returns a cached instance if such is available or a new one is instantiated. |
static
AccessibilityRecordCompat
|
obtain()
Returns a cached instance if such is available or a new one is instantiated. |
void
|
recycle()
Return an instance back to be reused. |
void
|
setAddedCount(int addedCount)
Sets the number of added characters. |
void
|
setBeforeText(CharSequence beforeText)
Sets the text before a change. |
void
|
setChecked(boolean isChecked)
Sets if the source is checked. |
void
|
setClassName(CharSequence className)
Sets the class name of the source. |
void
|
setContentDescription(CharSequence contentDescription)
Sets the description of the source. |
void
|
setCurrentItemIndex(int currentItemIndex)
Sets the index of the source in the list of items that can be visited. |
void
|
setEnabled(boolean isEnabled)
Sets if the source is enabled. |
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. |
void
|
setFullScreen(boolean isFullScreen)
Sets if the source is taking the entire screen. |
void
|
setItemCount(int itemCount)
Sets the number of items that can be visited. |
void
|
setMaxScrollX(int maxScrollX)
Sets the max scroll offset of the source left edge in pixels. |
void
|
setMaxScrollY(int maxScrollY)
Sets the max scroll offset of the source top edge in pixels. |
void
|
setParcelableData(Parcelable parcelableData)
Sets the |
void
|
setPassword(boolean isPassword)
Sets if the source is a password field. |
void
|
setRemovedCount(int removedCount)
Sets the number of removed characters. |
void
|
setScrollX(int scrollX)
Sets the scroll offset of the source left edge in pixels. |
void
|
setScrollY(int scrollY)
Sets the scroll offset of the source top edge in pixels. |
void
|
setScrollable(boolean scrollable)
Sets if the source is scrollable. |
void
|
setSource(View root, int virtualDescendantId)
Sets the source to be a virtual descendant of the given |
void
|
setSource(View source)
Sets the event source. |
void
|
setToIndex(int toIndex)
Sets the index of text selection end or the index of the last visible item when scrolling. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
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
asRecord(AccessibilityEvent)
. This method will be removed
in a subsequent release of the support library.
Parameters | |
---|---|
record |
Object
|
boolean equals (Object obj)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
Parameters | |
---|---|
obj |
Object :
the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
int getAddedCount ()
Gets the number of added characters.
Returns | |
---|---|
int |
The number of added characters. |
CharSequence getBeforeText ()
Sets the text before a change.
Returns | |
---|---|
CharSequence |
The text before the change. |
CharSequence getClassName ()
Gets the class name of the source.
Returns | |
---|---|
CharSequence |
The class name. |
CharSequence getContentDescription ()
Gets the description of the source.
Returns | |
---|---|
CharSequence |
The description. |
int getCurrentItemIndex ()
Gets the index of the source in the list of items the can be visited.
Returns | |
---|---|
int |
The current item index. |
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. |
Object getImpl ()
This method is deprecated.
This method will be removed in a subsequent release of
the support library.
Returns | |
---|---|
Object |
The wrapped implementation. |
int getItemCount ()
Gets the number of items that can be visited.
Returns | |
---|---|
int |
The number of items. |
int getMaxScrollX ()
Gets the max scroll offset of the source left edge in pixels.
Returns | |
---|---|
int |
The max scroll. |
int getMaxScrollY ()
Gets the max scroll offset of the source top edge in pixels.
Returns | |
---|---|
int |
The max scroll. |
Parcelable getParcelableData ()
Gets the Parcelable
data.
Returns | |
---|---|
Parcelable |
The parcelable data. |
int getRemovedCount ()
Gets the number of removed characters.
Returns | |
---|---|
int |
The number of removed characters. |
int getScrollX ()
Gets the scroll offset of the source left edge in pixels.
Returns | |
---|---|
int |
The scroll. |
int getScrollY ()
Gets the scroll offset of the source top edge in pixels.
Returns | |
---|---|
int |
The scroll. |
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. |
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. |
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. |
int getWindowId ()
Gets the id of the window from which the event comes from.
Returns | |
---|---|
int |
The window id. |
int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
equals(java.lang.Object)
method, then calling the hashCode
method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
Returns | |
---|---|
int |
a hash code value for this object. |
boolean isChecked ()
Gets if the source is checked.
Returns | |
---|---|
boolean |
True if the view is checked, false otherwise. |
boolean isEnabled ()
Gets if the source is enabled.
Returns | |
---|---|
boolean |
True if the view is enabled, false otherwise. |
boolean isFullScreen ()
Gets if the source is taking the entire screen.
Returns | |
---|---|
boolean |
True if the source is full screen, false otherwise. |
boolean isPassword ()
Gets if the source is a password field.
Returns | |
---|---|
boolean |
True if the view is a password field, false otherwise. |
boolean isScrollable ()
Gets if the source is scrollable.
Returns | |
---|---|
boolean |
True if the source is scrollable, false otherwise. |
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.
Parameters | |
---|---|
record |
AccessibilityRecordCompat
|
Returns | |
---|---|
AccessibilityRecordCompat |
An instance. |
AccessibilityRecordCompat obtain ()
Returns a cached instance if such is available or a new one is instantiated.
Returns | |
---|---|
AccessibilityRecordCompat |
An instance. |
void recycle ()
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. |
void setAddedCount (int addedCount)
Sets the number of added characters.
Parameters | |
---|---|
addedCount |
int :
The number of added characters. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setBeforeText (CharSequence beforeText)
Sets the text before a change.
Parameters | |
---|---|
beforeText |
CharSequence :
The text before the change. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setChecked (boolean isChecked)
Sets if the source is checked.
Parameters | |
---|---|
isChecked |
boolean :
True if the view is checked, false otherwise. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setClassName (CharSequence className)
Sets the class name of the source.
Parameters | |
---|---|
className |
CharSequence :
The lass name. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setContentDescription (CharSequence contentDescription)
Sets the description of the source.
Parameters | |
---|---|
contentDescription |
CharSequence :
The description. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setCurrentItemIndex (int currentItemIndex)
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. |
void setEnabled (boolean isEnabled)
Sets if the source is enabled.
Parameters | |
---|---|
isEnabled |
boolean :
True if the view is enabled, false otherwise. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
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 | |
---|---|
fromIndex |
int :
The index of the first character or selection
start or the first visible item. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setFullScreen (boolean isFullScreen)
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. |
void setItemCount (int itemCount)
Sets the number of items that can be visited.
Parameters | |
---|---|
itemCount |
int :
The number of items. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setMaxScrollX (int maxScrollX)
Sets the max scroll offset of the source left edge in pixels.
Parameters | |
---|---|
maxScrollX |
int :
The max scroll.
|
void setMaxScrollY (int maxScrollY)
Sets the max scroll offset of the source top edge in pixels.
Parameters | |
---|---|
maxScrollY |
int :
The max scroll.
|
void setParcelableData (Parcelable parcelableData)
Sets the Parcelable
data of the event.
Parameters | |
---|---|
parcelableData |
Parcelable :
The parcelable data. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setPassword (boolean isPassword)
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. |
void setRemovedCount (int removedCount)
Sets the number of removed characters.
Parameters | |
---|---|
removedCount |
int :
The number of removed characters. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setScrollX (int scrollX)
Sets the scroll offset of the source left edge in pixels.
Parameters | |
---|---|
scrollX |
int :
The scroll.
|
void setScrollY (int scrollY)
Sets the scroll offset of the source top edge in pixels.
Parameters | |
---|---|
scrollY |
int :
The scroll.
|
void setScrollable (boolean scrollable)
Sets if the source is scrollable.
Parameters | |
---|---|
scrollable |
boolean :
True if the source is scrollable, false otherwise. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
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 | |
---|---|
root |
View :
The root of the virtual subtree. |
virtualDescendantId |
int :
The id of the virtual descendant.
|
void setSource (View source)
Sets the event source.
Parameters | |
---|---|
source |
View :
The source. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setToIndex (int toIndex)
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.
|