Merge "Send AccessibilityEvent.CONTENT_CHANGE_TYPE_INVALID when TextView set errors"
This commit is contained in:
@@ -51848,6 +51848,7 @@ package android.view.accessibility {
|
||||
field public static final int CONTENT_CHANGE_TYPE_DRAG_CANCELLED = 512; // 0x200
|
||||
field public static final int CONTENT_CHANGE_TYPE_DRAG_DROPPED = 256; // 0x100
|
||||
field public static final int CONTENT_CHANGE_TYPE_DRAG_STARTED = 128; // 0x80
|
||||
field public static final int CONTENT_CHANGE_TYPE_INVALID = 1024; // 0x400
|
||||
field public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED = 16; // 0x10
|
||||
field public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED = 32; // 0x20
|
||||
field public static final int CONTENT_CHANGE_TYPE_PANE_TITLE = 8; // 0x8
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.util.BitUtils;
|
||||
|
||||
@@ -685,6 +686,18 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
|
||||
*/
|
||||
public static final int CONTENT_CHANGE_TYPE_DRAG_CANCELLED = 0x0000200;
|
||||
|
||||
/**
|
||||
* Change type for {@link #TYPE_WINDOW_CONTENT_CHANGED} event:
|
||||
* It means the content is invalid or associated with an error.
|
||||
* For example, text that sets an error message, such as when input isn't in a valid format,
|
||||
* should send this event and use {@link AccessibilityNodeInfo#setError} to
|
||||
* provide more context.
|
||||
*
|
||||
* @see AccessibilityNodeInfo#setError
|
||||
* @see TextView#setError
|
||||
*/
|
||||
public static final int CONTENT_CHANGE_TYPE_INVALID = 0x0000400;
|
||||
|
||||
/** Change type for {@link #TYPE_SPEECH_STATE_CHANGE} event: another service is speaking. */
|
||||
public static final int SPEECH_STATE_SPEAKING_START = 0x00000001;
|
||||
|
||||
@@ -810,6 +823,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
|
||||
CONTENT_CHANGE_TYPE_DRAG_STARTED,
|
||||
CONTENT_CHANGE_TYPE_DRAG_DROPPED,
|
||||
CONTENT_CHANGE_TYPE_DRAG_CANCELLED,
|
||||
CONTENT_CHANGE_TYPE_INVALID,
|
||||
})
|
||||
public @interface ContentChangeTypes {}
|
||||
|
||||
@@ -1076,6 +1090,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
|
||||
case CONTENT_CHANGE_TYPE_DRAG_STARTED: return "CONTENT_CHANGE_TYPE_DRAG_STARTED";
|
||||
case CONTENT_CHANGE_TYPE_DRAG_DROPPED: return "CONTENT_CHANGE_TYPE_DRAG_DROPPED";
|
||||
case CONTENT_CHANGE_TYPE_DRAG_CANCELLED: return "CONTENT_CHANGE_TYPE_DRAG_CANCELLED";
|
||||
case CONTENT_CHANGE_TYPE_INVALID: return "CONTENT_CHANGE_TYPE_INVALID";
|
||||
default: return Integer.toHexString(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7644,7 +7644,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
createEditorIfNeeded();
|
||||
mEditor.setError(error, icon);
|
||||
notifyViewAccessibilityStateChangedIfNeeded(
|
||||
AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);
|
||||
AccessibilityEvent.CONTENT_CHANGE_TYPE_INVALID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user