AccessibilityEventCompat
public
final
class
AccessibilityEventCompat
extends Object
java.lang.Object | |
↳ | androidx.core.view.accessibility.AccessibilityEventCompat |
Helper for accessing features in AccessibilityEvent
.
Summary
Constants | |
---|---|
int |
CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
Change type for |
int |
CONTENT_CHANGE_TYPE_PANE_APPEARED
Change type for |
int |
CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
Change type for |
int |
CONTENT_CHANGE_TYPE_PANE_TITLE
Change type for |
int |
CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
Change type for |
int |
CONTENT_CHANGE_TYPE_SUBTREE
Change type for |
int |
CONTENT_CHANGE_TYPE_TEXT
Change type for |
int |
CONTENT_CHANGE_TYPE_UNDEFINED
Change type for |
int |
TYPES_ALL_MASK
Mask for |
int |
TYPE_ANNOUNCEMENT
Represents the event of an application making an announcement. |
int |
TYPE_ASSIST_READING_CONTEXT
Represents the event of the assistant currently reading the users screen context. |
int |
TYPE_GESTURE_DETECTION_END
Represents the event of ending gesture detection. |
int |
TYPE_GESTURE_DETECTION_START
Represents the event of beginning gesture detection. |
int |
TYPE_TOUCH_EXPLORATION_GESTURE_END
This constant is deprecated.
Use |
int |
TYPE_TOUCH_EXPLORATION_GESTURE_START
This constant is deprecated.
Use |
int |
TYPE_TOUCH_INTERACTION_END
Represents the event of the user ending to touch the screen. |
int |
TYPE_TOUCH_INTERACTION_START
Represents the event of the user starting to touch the screen. |
int |
TYPE_VIEW_ACCESSIBILITY_FOCUSED
Represents the event of gaining accessibility focus. |
int |
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
Represents the event of clearing accessibility focus. |
int |
TYPE_VIEW_CONTEXT_CLICKED
Represents the event of a context click on a |
int |
TYPE_VIEW_HOVER_ENTER
This constant is deprecated.
Use |
int |
TYPE_VIEW_HOVER_EXIT
This constant is deprecated.
Use |
int |
TYPE_VIEW_SCROLLED
This constant is deprecated.
Use |
int |
TYPE_VIEW_TEXT_SELECTION_CHANGED
This constant is deprecated.
Use |
int |
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
Represents the event of traversing the text of a view at a given movement granularity. |
int |
TYPE_WINDOWS_CHANGED
Represents the event change in the windows shown on the screen. |
int |
TYPE_WINDOW_CONTENT_CHANGED
This constant is deprecated.
Use |
Public methods | |
---|---|
static
void
|
appendRecord(AccessibilityEvent event, AccessibilityRecordCompat record)
This method is deprecated.
Use |
static
AccessibilityRecordCompat
|
asRecord(AccessibilityEvent event)
This method is deprecated.
Use the |
static
int
|
getAction(AccessibilityEvent event)
Gets the performed action that triggered this event. |
static
int
|
getContentChangeTypes(AccessibilityEvent event)
Gets the bit mask of change types signaled by an
|
static
int
|
getMovementGranularity(AccessibilityEvent event)
Gets the movement granularity that was traversed. |
static
AccessibilityRecordCompat
|
getRecord(AccessibilityEvent event, int index)
This method is deprecated.
Use |
static
int
|
getRecordCount(AccessibilityEvent event)
This method is deprecated.
Use |
static
void
|
setAction(AccessibilityEvent event, int action)
Sets the performed action that triggered this event. |
static
void
|
setContentChangeTypes(AccessibilityEvent event, int changeTypes)
Sets the bit mask of node tree changes signaled by an
|
static
void
|
setMovementGranularity(AccessibilityEvent event, int granularity)
Sets the movement granularity that was traversed. |
Inherited methods | |
---|---|
Constants
CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
public static final int CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
Change type for TYPE_WINDOW_CONTENT_CHANGED
event:
The node's content description changed.
Constant Value: 4 (0x00000004)
CONTENT_CHANGE_TYPE_PANE_APPEARED
public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED
Change type for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
event:
The node has a pane title, and either just appeared or just was assigned a title when it
had none before.
Constant Value: 16 (0x00000010)
CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
Change type for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
event:
Can mean one of two slightly different things. The primary meaning is that the node has
a pane title, and was removed from the node hierarchy. It can also be sent if the pane
title is set to null
after it contained a title.
No source will be returned if the node is no longer on the screen. To make the change more
clear for the user, the first entry in AccessibilityRecord.getText()
can return the
value that would have been returned by getSource().getPaneTitle()
.
Constant Value: 32 (0x00000020)
CONTENT_CHANGE_TYPE_PANE_TITLE
public static final int CONTENT_CHANGE_TYPE_PANE_TITLE
Change type for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
event:
The node's pane title changed.
Constant Value: 8 (0x00000008)
CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
public static final int CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
Change type for AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
event:
state description of the node as returned by
AccessibilityNodeInfo.getStateDescription()
was changed.
Constant Value: 64 (0x00000040)
CONTENT_CHANGE_TYPE_SUBTREE
public static final int CONTENT_CHANGE_TYPE_SUBTREE
Change type for TYPE_WINDOW_CONTENT_CHANGED
event:
A node in the subtree rooted at the source node was added or removed.
Constant Value: 1 (0x00000001)
CONTENT_CHANGE_TYPE_TEXT
public static final int CONTENT_CHANGE_TYPE_TEXT
Change type for TYPE_WINDOW_CONTENT_CHANGED
event:
The node's text changed.
Constant Value: 2 (0x00000002)
CONTENT_CHANGE_TYPE_UNDEFINED
public static final int CONTENT_CHANGE_TYPE_UNDEFINED
Change type for TYPE_WINDOW_CONTENT_CHANGED
event:
The type of change is not defined.
Constant Value: 0 (0x00000000)
TYPES_ALL_MASK
public static final int TYPES_ALL_MASK
Mask for AccessibilityEvent
all types.
See also:
AccessibilityEvent.TYPE_VIEW_CLICKED
AccessibilityEvent.TYPE_VIEW_LONG_CLICKED
AccessibilityEvent.TYPE_VIEW_SELECTED
AccessibilityEvent.TYPE_VIEW_FOCUSED
AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED
AccessibilityEvent.TYPE_VIEW_HOVER_ENTER
AccessibilityEvent.TYPE_VIEW_HOVER_EXIT
AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START
AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END
AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
AccessibilityEvent.TYPE_VIEW_SCROLLED
AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED
TYPE_ANNOUNCEMENT
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
TYPE_GESTURE_DETECTION_START
TYPE_GESTURE_DETECTION_END
TYPE_TOUCH_INTERACTION_START
TYPE_TOUCH_INTERACTION_END
TYPE_WINDOWS_CHANGED
TYPE_VIEW_CONTEXT_CLICKED
TYPE_ASSIST_READING_CONTEXT
Constant Value: -1 (0xffffffff)
TYPE_ANNOUNCEMENT
public static final int TYPE_ANNOUNCEMENT
Represents the event of an application making an announcement.
Constant Value: 16384 (0x00004000)
TYPE_ASSIST_READING_CONTEXT
public static final int TYPE_ASSIST_READING_CONTEXT
Represents the event of the assistant currently reading the users screen context.
Constant Value: 16777216 (0x01000000)
TYPE_GESTURE_DETECTION_END
public static final int TYPE_GESTURE_DETECTION_END
Represents the event of ending gesture detection.
Constant Value: 524288 (0x00080000)
TYPE_GESTURE_DETECTION_START
public static final int TYPE_GESTURE_DETECTION_START
Represents the event of beginning gesture detection.
Constant Value: 262144 (0x00040000)
TYPE_TOUCH_EXPLORATION_GESTURE_END
public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END
This constant is deprecated.
Use AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END
directly.
Represents the event of ending a touch exploration gesture.
Constant Value: 1024 (0x00000400)
TYPE_TOUCH_EXPLORATION_GESTURE_START
public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START
This constant is deprecated.
Use AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START
directly.
Represents the event of starting a touch exploration gesture.
Constant Value: 512 (0x00000200)
TYPE_TOUCH_INTERACTION_END
public static final int TYPE_TOUCH_INTERACTION_END
Represents the event of the user ending to touch the screen.
Constant Value: 2097152 (0x00200000)
TYPE_TOUCH_INTERACTION_START
public static final int TYPE_TOUCH_INTERACTION_START
Represents the event of the user starting to touch the screen.
Constant Value: 1048576 (0x00100000)
TYPE_VIEW_ACCESSIBILITY_FOCUSED
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED
Represents the event of gaining accessibility focus.
Constant Value: 32768 (0x00008000)
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
Represents the event of clearing accessibility focus.
Constant Value: 65536 (0x00010000)
TYPE_VIEW_CONTEXT_CLICKED
public static final int TYPE_VIEW_CONTEXT_CLICKED
Represents the event of a context click on a View
.
Constant Value: 8388608 (0x00800000)
TYPE_VIEW_HOVER_ENTER
public static final int TYPE_VIEW_HOVER_ENTER
This constant is deprecated.
Use AccessibilityEvent.TYPE_VIEW_HOVER_ENTER
directly.
Represents the event of a hover enter over a View
.
Constant Value: 128 (0x00000080)
TYPE_VIEW_HOVER_EXIT
public static final int TYPE_VIEW_HOVER_EXIT
This constant is deprecated.
Use AccessibilityEvent.TYPE_VIEW_HOVER_EXIT
directly.
Represents the event of a hover exit over a View
.
Constant Value: 256 (0x00000100)
TYPE_VIEW_SCROLLED
public static final int TYPE_VIEW_SCROLLED
This constant is deprecated.
Use AccessibilityEvent.TYPE_VIEW_SCROLLED
directly.
Represents the event of scrolling a view.
Constant Value: 4096 (0x00001000)
TYPE_VIEW_TEXT_SELECTION_CHANGED
public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED
This constant is deprecated.
Use AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED
directly.
Represents the event of changing the selection in an EditText
.
Constant Value: 8192 (0x00002000)
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
Represents the event of traversing the text of a view at a given movement granularity.
Constant Value: 131072 (0x00020000)
TYPE_WINDOWS_CHANGED
public static final int TYPE_WINDOWS_CHANGED
Represents the event change in the windows shown on the screen.
Constant Value: 4194304 (0x00400000)
TYPE_WINDOW_CONTENT_CHANGED
public static final int TYPE_WINDOW_CONTENT_CHANGED
This constant is deprecated.
Use AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
directly.
Represents the event of changing the content of a window.
Constant Value: 2048 (0x00000800)
Public methods
appendRecord
public static void appendRecord (AccessibilityEvent event, AccessibilityRecordCompat record)
This method is deprecated.
Use AccessibilityEvent.appendRecord(AccessibilityRecord)
directly.
Appends an AccessibilityRecord
to the end of
event records.
Parameters | |
---|---|
event |
AccessibilityEvent |
record |
AccessibilityRecordCompat : The record to append. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
asRecord
public static AccessibilityRecordCompat asRecord (AccessibilityEvent event)
This method is deprecated.
Use the AccessibilityEvent
directly as AccessibilityRecord
.
Creates an AccessibilityRecordCompat
from an AccessibilityEvent
that can be used to manipulate the event properties defined in
AccessibilityRecord
.
Note: Do not call AccessibilityRecordCompat.recycle()
on the
returned AccessibilityRecordCompat
. Call AccessibilityEvent.recycle()
in case you want to recycle the event.
Parameters | |
---|---|
event |
AccessibilityEvent : The from which to create a record. |
Returns | |
---|---|
AccessibilityRecordCompat |
An AccessibilityRecordCompat . |
getAction
public static int getAction (AccessibilityEvent event)
Gets the performed action that triggered this event.
Parameters | |
---|---|
event |
AccessibilityEvent |
Returns | |
---|---|
int |
The action. |
getContentChangeTypes
public static int getContentChangeTypes (AccessibilityEvent event)
Gets the bit mask of change types signaled by an
TYPE_WINDOW_CONTENT_CHANGED
event. A single event may represent
multiple change types.
Parameters | |
---|---|
event |
AccessibilityEvent |
Returns | |
---|---|
int |
The bit mask of change types. One or more of: |
getMovementGranularity
public static int getMovementGranularity (AccessibilityEvent event)
Gets the movement granularity that was traversed.
Parameters | |
---|---|
event |
AccessibilityEvent |
Returns | |
---|---|
int |
The granularity. |
getRecord
public static AccessibilityRecordCompat getRecord (AccessibilityEvent event, int index)
This method is deprecated.
Use AccessibilityEvent.getRecord(int)
directly.
Gets the record at a given index.
Parameters | |
---|---|
event |
AccessibilityEvent |
index |
int : The index. |
Returns | |
---|---|
AccessibilityRecordCompat |
The record at the specified index. |
getRecordCount
public static int getRecordCount (AccessibilityEvent event)
This method is deprecated.
Use AccessibilityEvent.getRecordCount()
directly.
Gets the number of records contained in the event.
Parameters | |
---|---|
event |
AccessibilityEvent |
Returns | |
---|---|
int |
The number of records. |
setAction
public static void setAction (AccessibilityEvent event, int action)
Sets the performed action that triggered this event.
Valid actions are defined in AccessibilityNodeInfoCompat
:
AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS
AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS
AccessibilityNodeInfoCompat.ACTION_CLEAR_FOCUS
AccessibilityNodeInfoCompat.ACTION_CLEAR_SELECTION
AccessibilityNodeInfoCompat.ACTION_CLICK
- etc.
Parameters | |
---|---|
event |
AccessibilityEvent |
action |
int : The action. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setContentChangeTypes
public static void setContentChangeTypes (AccessibilityEvent event, int changeTypes)
Sets the bit mask of node tree changes signaled by an
TYPE_WINDOW_CONTENT_CHANGED
event.
Parameters | |
---|---|
event |
AccessibilityEvent |
changeTypes |
int : The bit mask of change types. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
setMovementGranularity
public static void setMovementGranularity (AccessibilityEvent event, int granularity)
Sets the movement granularity that was traversed.
Parameters | |
---|---|
event |
AccessibilityEvent |
granularity |
int : The granularity. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |