AccessibilityEvent.java revision 3fb3d7c4e756bd32d5abde0abca9ab52d559bc84
175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/* 275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Copyright (C) 2009 The Android Open Source Project 375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Licensed under the Apache License, Version 2.0 (the "License"); 575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * you may not use this file except in compliance with the License. 675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * You may obtain a copy of the License at 775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * http://www.apache.org/licenses/LICENSE-2.0 975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 1075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Unless required by applicable law or agreed to in writing, software 1175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * distributed under the License is distributed on an "AS IS" BASIS, 1275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * See the License for the specific language governing permissions and 1475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * limitations under the License. 1575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 1675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 1775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovpackage android.view.accessibility; 1875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 1975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.os.Parcel; 2075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.os.Parcelable; 2175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.text.TextUtils; 2275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport java.util.ArrayList; 243fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powellimport java.util.List; 2575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/** 2775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents accessibility events that are sent by the system when 2875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * something notable happens in the user interface. For example, when a 2975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button} is clicked, a {@link android.view.View} is focused, etc. 3075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 3175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents various semantically different accessibility event 3275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * types. Each event type has associated a set of related properties. In other 3375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * words, each event type is characterized via a subset of the properties exposed 3475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * by this class. For each event type there is a corresponding constant defined 3575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * in this class. Since some event types are semantically close there are mask 3675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * constants that group them together. Follows a specification of the event 3775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * types and their associated properties: 3875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 3975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>VIEW TYPES</b> <br> 4075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 4175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View clicked</b> - represents the event of clicking on a {@link android.view.View} 4275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc. <br> 4375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type:{@link #TYPE_VIEW_CLICKED} <br> 4475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 4575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 4675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 4775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 4875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()}, 4975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isChecked()}, 5075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isEnabled()}, 5175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isPassword()}, 5275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getItemCount()}, 5375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getCurrentItemIndex()} 5475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 5575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View long clicked</b> - represents the event of long clicking on a {@link android.view.View} 5675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc. <br> 5775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type:{@link #TYPE_VIEW_LONG_CLICKED} <br> 5875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 5975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 6075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 6175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 6275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()}, 6375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isChecked()}, 6475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isEnabled()}, 6575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isPassword()}, 6675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getItemCount()}, 6775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getCurrentItemIndex()} 6875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 6975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View selected</b> - represents the event of selecting an item usually in 7075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * the context of an {@link android.widget.AdapterView}. <br> 7175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type: {@link #TYPE_VIEW_SELECTED} <br> 7275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 7375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 7475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 7575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 7675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()}, 7775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isChecked()}, 7875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isEnabled()}, 7975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isPassword()}, 8075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getItemCount()}, 8175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getCurrentItemIndex()} 8275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 8375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View focused</b> - represents the event of focusing a 8475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.view.View}. <br> 8575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type: {@link #TYPE_VIEW_FOCUSED} <br> 8675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 8775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 8875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 8975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 9075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()}, 9175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isChecked()}, 9275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isEnabled()}, 9375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isPassword()}, 9475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getItemCount()}, 9575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getCurrentItemIndex()} 9675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 9775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View text changed</b> - represents the event of changing the text of an 9875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.EditText}. <br> 9975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type: {@link #TYPE_VIEW_TEXT_CHANGED} <br> 10075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 10175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 10275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 10375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 10475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()}, 10575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isChecked()}, 10675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isEnabled()}, 10775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #isPassword()}, 10875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getItemCount()}, 10975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getCurrentItemIndex()}, 11075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getFromIndex()}, 11175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getAddedCount()}, 11275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getRemovedCount()}, 11375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getBeforeText()} 11475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 11575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>TRANSITION TYPES</b> <br> 11675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 11775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Window state changed</b> - represents the event of opening/closing a 11875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.PopupWindow}, {@link android.view.Menu}, 11975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.app.Dialog}, etc. <br> 12075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type: {@link #TYPE_WINDOW_STATE_CHANGED} <br> 12175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 12275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 12375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 12475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 12575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()} 12675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 12775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>NOTIFICATION TYPES</b> <br> 12875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 12975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Notification state changed</b> - represents the event showing/hiding 13075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.app.Notification}. 13175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Type: {@link #TYPE_NOTIFICATION_STATE_CHANGED} <br> 13275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Properties: 13375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getClassName()}, 13475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getPackageName()}, 13575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getEventTime()}, 13675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getText()} 13775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link #getParcelableData()} 13875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 13975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Security note</b> 14075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 14175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Since an event contains the text of its source privacy can be compromised by leaking of 14275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * sensitive information such as passwords. To address this issue any event fired in response 14375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * to manipulation of a PASSWORD field does NOT CONTAIN the text of the password. 14475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 14575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.view.accessibility.AccessibilityManager 14675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.accessibilityservice.AccessibilityService 14775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 1483fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powellpublic final class AccessibilityEvent implements Parcelable { 14975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 15075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 15175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Invalid selection/focus position. 15275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 15375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #getCurrentItemIndex() 15475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 15575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int INVALID_POSITION = -1; 15675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 15775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 15875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Maximum length of the text fields. 15975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 16075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #getBeforeText() 16175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #getText() 162c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * </br> 163c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * Note: This constant is no longer needed since there 164c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * is no limit on the length of text that is contained 165c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * in an accessibility event anymore. 16675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 167c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov @Deprecated 16875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int MAX_TEXT_LENGTH = 500; 16975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 17075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 17175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of clicking on a {@link android.view.View} like 17275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc. 17375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 17475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_CLICKED = 0x00000001; 17575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 17675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 17775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of long clicking on a {@link android.view.View} like 17875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc. 17975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 18075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_LONG_CLICKED = 0x00000002; 18175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 18275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 18375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of selecting an item usually in the context of an 18475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.AdapterView}. 18575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 18675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_SELECTED = 0x00000004; 18775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 18875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 18975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of focusing a {@link android.view.View}. 19075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 19175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_FOCUSED = 0x00000008; 19275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 19375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 19475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of changing the text of an {@link android.widget.EditText}. 19575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 19675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_TEXT_CHANGED = 0x00000010; 19775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 19875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 19975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of opening/closing a {@link android.widget.PopupWindow}, 20075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.view.Menu}, {@link android.app.Dialog}, etc. 20175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 20275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_WINDOW_STATE_CHANGED = 0x00000020; 20375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 20475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 20575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event showing/hiding a {@link android.app.Notification}. 20675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 20775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_NOTIFICATION_STATE_CHANGED = 0x00000040; 20875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 20975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 21075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Mask for {@link AccessibilityEvent} all types. 21175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 21275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_CLICKED 21375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_LONG_CLICKED 21475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_SELECTED 21575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_FOCUSED 21675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_TEXT_CHANGED 21775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_WINDOW_STATE_CHANGED 21875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_NOTIFICATION_STATE_CHANGED 21975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 22075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPES_ALL_MASK = 0xFFFFFFFF; 22175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2223fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private static final int MAX_POOL_SIZE = 2; 22375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private static final Object mPoolLock = new Object(); 22475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private static AccessibilityEvent sPool; 22575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private static int sPoolSize; 22675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2273fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private static final int CHECKED = 0x00000001; 2283fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private static final int ENABLED = 0x00000002; 2293fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private static final int PASSWORD = 0x00000004; 2303fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private static final int FULL_SCREEN = 0x00000080; 2313fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 23275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private AccessibilityEvent mNext; 23375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 23475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private int mEventType; 2353fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private int mBooleanProperties; 2363fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private int mCurrentItemIndex; 2373fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private int mItemCount; 2383fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private int mFromIndex; 2393fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private int mAddedCount; 2403fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private int mRemovedCount; 2413fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 242ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov private long mEventTime; 24375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2443fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private CharSequence mClassName; 2453fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private CharSequence mPackageName; 2463fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private CharSequence mContentDescription; 2473fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private CharSequence mBeforeText; 2483fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2493fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private Parcelable mParcelableData; 2503fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2513fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private final List<CharSequence> mText = new ArrayList<CharSequence>(); 2523fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2533fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private boolean mIsInPool; 25475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 25575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /* 25675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Hide constructor from clients. 25775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 25875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private AccessibilityEvent() { 2593fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mCurrentItemIndex = INVALID_POSITION; 2603fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 2613fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2623fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 2633fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets if the source is checked. 2643fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 2653fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return True if the view is checked, false otherwise. 2663fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 2673fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public boolean isChecked() { 2683fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return getBooleanProperty(CHECKED); 2693fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 2703fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2713fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 2723fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets if the source is checked. 2733fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 2743fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param isChecked True if the view is checked, false otherwise. 2753fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 2763fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setChecked(boolean isChecked) { 2773fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell setBooleanProperty(CHECKED, isChecked); 2783fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 27975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2803fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 2813fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets if the source is enabled. 2823fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 2833fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return True if the view is enabled, false otherwise. 2843fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 2853fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public boolean isEnabled() { 2863fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return getBooleanProperty(ENABLED); 2873fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 2883fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2893fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 2903fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets if the source is enabled. 2913fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 2923fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param isEnabled True if the view is enabled, false otherwise. 2933fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 2943fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setEnabled(boolean isEnabled) { 2953fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell setBooleanProperty(ENABLED, isEnabled); 2963fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 2973fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 2983fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 2993fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets if the source is a password field. 3003fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 3013fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return True if the view is a password field, false otherwise. 3023fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 3033fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public boolean isPassword() { 3043fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return getBooleanProperty(PASSWORD); 30575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 30675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 30775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 3083fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets if the source is a password field. 30975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 3103fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param isPassword True if the view is a password field, false otherwise. 31175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 3123fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setPassword(boolean isPassword) { 3133fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell setBooleanProperty(PASSWORD, isPassword); 31475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 31575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 31675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 3173fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets if the source is taking the entire screen. 31875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 3193fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param isFullScreen True if the source is full screen, false otherwise. 32075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 3213fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setFullScreen(boolean isFullScreen) { 3223fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell setBooleanProperty(FULL_SCREEN, isFullScreen); 32375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 32475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 32575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 3263fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets if the source is taking the entire screen. 32775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 3283fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return True if the source is full screen, false otherwise. 32975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 3303fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public boolean isFullScreen() { 3313fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return getBooleanProperty(FULL_SCREEN); 33275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 33375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 33475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 33575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Gets the event type. 33675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 33775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return The event type. 33875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 33975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public int getEventType() { 34075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return mEventType; 34175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 34275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 34375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 34475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Sets the event type. 34575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 34675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param eventType The event type. 34775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 34875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void setEventType(int eventType) { 34975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mEventType = eventType; 35075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 35175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 35275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 3533fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the number of items that can be visited. 3543fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 3553fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The number of items. 3563fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 3573fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public int getItemCount() { 3583fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mItemCount; 3593fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 3603fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 3613fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 3623fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the number of items that can be visited. 3633fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 3643fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param itemCount The number of items. 3653fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 3663fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setItemCount(int itemCount) { 3673fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mItemCount = itemCount; 3683fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 3693fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 3703fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 3713fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the index of the source in the list of items the can be visited. 3723fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 3733fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The current item index. 3743fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 3753fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public int getCurrentItemIndex() { 3763fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mCurrentItemIndex; 3773fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 3783fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 3793fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 3803fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the index of the source in the list of items that can be visited. 3813fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 3823fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param currentItemIndex The current item index. 3833fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 3843fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setCurrentItemIndex(int currentItemIndex) { 3853fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mCurrentItemIndex = currentItemIndex; 3863fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 3873fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 3883fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 3893fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the index of the first character of the changed sequence. 3903fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 3913fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The index of the first character. 3923fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 3933fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public int getFromIndex() { 3943fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mFromIndex; 3953fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 3963fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 3973fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 3983fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the index of the first character of the changed sequence. 3993fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4003fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param fromIndex The index of the first character. 4013fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4023fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setFromIndex(int fromIndex) { 4033fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mFromIndex = fromIndex; 4043fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4053fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4063fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 4073fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the number of added characters. 4083fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4093fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The number of added characters. 4103fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4113fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public int getAddedCount() { 4123fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mAddedCount; 4133fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4143fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4153fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 4163fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the number of added characters. 4173fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4183fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param addedCount The number of added characters. 4193fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4203fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setAddedCount(int addedCount) { 4213fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mAddedCount = addedCount; 4223fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4233fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4243fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 4253fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the number of removed characters. 4263fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4273fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The number of removed characters. 4283fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4293fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public int getRemovedCount() { 4303fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mRemovedCount; 4313fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4323fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4333fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 4343fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the number of removed characters. 4353fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4363fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param removedCount The number of removed characters. 4373fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4383fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setRemovedCount(int removedCount) { 4393fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mRemovedCount = removedCount; 4403fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4413fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4423fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 44375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Gets the time in which this event was sent. 44475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 44575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return The event time. 44675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 44775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public long getEventTime() { 44875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return mEventTime; 44975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 45075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 45175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 45275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Sets the time in which this event was sent. 45375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 45475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param eventTime The event time. 45575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 45675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void setEventTime(long eventTime) { 45775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mEventTime = eventTime; 45875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 45975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 46075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 4613fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the class name of the source. 4623fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4633fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The class name. 4643fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4653fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public CharSequence getClassName() { 4663fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mClassName; 4673fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4683fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4693fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 4703fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the class name of the source. 4713fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 4723fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param className The lass name. 4733fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 4743fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setClassName(CharSequence className) { 4753fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mClassName = className; 4763fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 4773fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 4783fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 47975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Gets the package name of the source. 48075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 48175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return The package name. 48275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 48375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public CharSequence getPackageName() { 48475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return mPackageName; 48575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 48675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 48775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 48875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Sets the package name of the source. 48975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 49075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param packageName The package name. 49175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 49275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void setPackageName(CharSequence packageName) { 49375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mPackageName = packageName; 49475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 49575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 49675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 4973fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the text of the event. The index in the list represents the priority 4983fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * of the text. Specifically, the lower the index the higher the priority. 4993fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5003fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The text. 5013fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5023fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public List<CharSequence> getText() { 5033fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mText; 5043fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5053fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5063fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 5073fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the text before a change. 5083fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5093fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The text before the change. 5103fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5113fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public CharSequence getBeforeText() { 5123fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mBeforeText; 5133fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5143fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5153fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 5163fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the text before a change. 5173fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5183fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param beforeText The text before the change. 5193fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5203fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setBeforeText(CharSequence beforeText) { 5213fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBeforeText = beforeText; 5223fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5233fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5243fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 5253fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the description of the source. 5263fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5273fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The description. 5283fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5293fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public CharSequence getContentDescription() { 5303fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mContentDescription; 5313fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5323fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5333fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 5343fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the description of the source. 5353fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5363fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param contentDescription The description. 5373fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5383fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setContentDescription(CharSequence contentDescription) { 5393fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mContentDescription = contentDescription; 5403fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5413fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5423fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 5433fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the {@link Parcelable} data. 5443fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5453fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The parcelable data. 5463fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5473fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public Parcelable getParcelableData() { 5483fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return mParcelableData; 5493fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5503fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5513fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 5523fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets the {@link Parcelable} data of the event. 5533fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 5543fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param parcelableData The parcelable data. 5553fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 5563fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void setParcelableData(Parcelable parcelableData) { 5573fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mParcelableData = parcelableData; 5583fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 5593fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 5603fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell /** 56175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Returns a cached instance if such is available or a new one is 56275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * instantiated with type property set. 56375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 56475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param eventType The event type. 56575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return An instance. 56675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 56775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static AccessibilityEvent obtain(int eventType) { 56875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov AccessibilityEvent event = AccessibilityEvent.obtain(); 56975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.setEventType(eventType); 57075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return event; 57175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 57275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 57375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 57475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Returns a cached instance if such is available or a new one is 57575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * instantiated. 57675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 57775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return An instance. 57875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 57975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static AccessibilityEvent obtain() { 58075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov synchronized (mPoolLock) { 58175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov if (sPool != null) { 58275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov AccessibilityEvent event = sPool; 58375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPool = sPool.mNext; 58475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPoolSize--; 58575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.mNext = null; 58675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.mIsInPool = false; 58775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return event; 58875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 58975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return new AccessibilityEvent(); 59075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 59175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 59275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 59375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 59475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Return an instance back to be reused. 59575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 59675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Note: You must not touch the object after calling this function.</b> 59775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 59875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void recycle() { 59975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov if (mIsInPool) { 60075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return; 60175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 6023fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 60375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov clear(); 60475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov synchronized (mPoolLock) { 60575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov if (sPoolSize <= MAX_POOL_SIZE) { 60675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mNext = sPool; 60775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPool = this; 60875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mIsInPool = true; 60975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPoolSize++; 61075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 61175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 61275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 61375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 61475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 61575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Clears the state of this instance. 61675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 6173fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private void clear() { 61875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mEventType = 0; 6193fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBooleanProperties = 0; 6203fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mCurrentItemIndex = INVALID_POSITION; 6213fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mItemCount = 0; 6223fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mFromIndex = 0; 6233fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mAddedCount = 0; 6243fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mRemovedCount = 0; 625ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov mEventTime = 0; 6263fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mClassName = null; 6273fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mPackageName = null; 6283fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mContentDescription = null; 6293fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBeforeText = null; 6303fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mParcelableData = null; 6313fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mText.clear(); 63275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 63375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 63475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 6353fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Gets the value of a boolean property. 63675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 6373fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param property The property. 6383fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @return The value. 63975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 6403fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private boolean getBooleanProperty(int property) { 6413fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell return (mBooleanProperties & property) == property; 64275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 64375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 644ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov /** 6453fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Sets a boolean property. 646ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov * 6473fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param property The property. 6483fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param value The value. 6493fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell */ 6503fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private void setBooleanProperty(int property, boolean value) { 6513fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell if (value) { 6523fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBooleanProperties |= property; 6533fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } else { 6543fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBooleanProperties &= ~property; 6553fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 656ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov } 657ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov 658ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov /** 6593fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Creates a new instance from a {@link Parcel}. 6603fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 6613fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param parcel A parcel containing the state of a {@link AccessibilityEvent}. 662ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov */ 6633fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void initFromParcel(Parcel parcel) { 6643fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mEventType = parcel.readInt(); 6653fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBooleanProperties = parcel.readInt(); 6663fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mCurrentItemIndex = parcel.readInt(); 6673fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mItemCount = parcel.readInt(); 6683fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mFromIndex = parcel.readInt(); 6693fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mAddedCount = parcel.readInt(); 6703fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mRemovedCount = parcel.readInt(); 6713fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mEventTime = parcel.readLong(); 6723fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mClassName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 6733fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mPackageName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 6743fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 6753fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mBeforeText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 6763fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mParcelableData = parcel.readParcelable(null); 6773fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.readList(mText, null); 6783fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 6793fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 68075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void writeToParcel(Parcel parcel, int flags) { 68175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov parcel.writeInt(mEventType); 6823fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeInt(mBooleanProperties); 6833fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeInt(mCurrentItemIndex); 6843fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeInt(mItemCount); 6853fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeInt(mFromIndex); 6863fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeInt(mAddedCount); 6873fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeInt(mRemovedCount); 688ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov parcel.writeLong(mEventTime); 6893fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell TextUtils.writeToParcel(mClassName, parcel, 0); 6903fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell TextUtils.writeToParcel(mPackageName, parcel, 0); 6913fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell TextUtils.writeToParcel(mContentDescription, parcel, 0); 6923fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell TextUtils.writeToParcel(mBeforeText, parcel, 0); 6933fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeParcelable(mParcelableData, flags); 6943fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell parcel.writeList(mText); 69575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 69675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 69775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public int describeContents() { 69875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return 0; 69975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 70075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 70175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov @Override 70275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public String toString() { 70375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov StringBuilder builder = new StringBuilder(); 7043fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append(super.toString()); 70575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov builder.append("; EventType: " + mEventType); 70675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov builder.append("; EventTime: " + mEventTime); 7073fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; ClassName: " + mClassName); 70875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov builder.append("; PackageName: " + mPackageName); 7093fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; Text: " + mText); 7103fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; ContentDescription: " + mContentDescription); 7113fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; ItemCount: " + mItemCount); 7123fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; CurrentItemIndex: " + mCurrentItemIndex); 7133fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; IsEnabled: " + isEnabled()); 7143fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; IsPassword: " + isPassword()); 7153fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; IsChecked: " + isChecked()); 7163fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; IsFullScreen: " + isFullScreen()); 7173fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; BeforeText: " + mBeforeText); 7183fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; FromIndex: " + mFromIndex); 7193fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; AddedCount: " + mAddedCount); 7203fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; RemovedCount: " + mRemovedCount); 7213fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell builder.append("; ParcelableData: " + mParcelableData); 72275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return builder.toString(); 72375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 72475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 72575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 72675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see Parcelable.Creator 72775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 72875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final Parcelable.Creator<AccessibilityEvent> CREATOR = 72975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov new Parcelable.Creator<AccessibilityEvent>() { 73075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public AccessibilityEvent createFromParcel(Parcel parcel) { 73175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov AccessibilityEvent event = AccessibilityEvent.obtain(); 73275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.initFromParcel(parcel); 73375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return event; 73475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 73575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 73675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public AccessibilityEvent[] newArray(int size) { 73775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return new AccessibilityEvent[size]; 73875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 73975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov }; 74075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov} 741