Skip to content

Commit 031d9c1

Browse files
committed
Adding accessibility delegate mechanism for backwards compatibility support.
1. Added an AccessibilityDelegate class in View which can be set by a client that wants to cutomize accessibility behavior via composition as opposed to inheritance. Insead overriding a new method in View thus being bound to the API version that introduced this method a developer can conditionally inject the accessibility customization if the platform API version is heigh enough. The developer will have to override the method of interest of the delegate. The default implementation of the delegate methods is the same as that of View in the case that there is no delegate set. If a delegate is set calling an accessibility related method on View will be handed off to the corresponsing method of the delegate. bug:5259555 Change-Id: I00e750e22e5e7164a1b571cb3d12ecaf4ab93db4
1 parent 5e87525 commit 031d9c1

File tree

6 files changed

+383
-12
lines changed

6 files changed

+383
-12
lines changed

api/current.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22950,6 +22950,7 @@ package android.view {
2295022950
method public void scrollTo(int, int);
2295122951
method public void sendAccessibilityEvent(int);
2295222952
method public void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent);
22953+
method public void setAccessibilityDelegate(android.view.View.AccessibilityDelegate);
2295322954
method public void setActivated(boolean);
2295422955
method public void setAlpha(float);
2295522956
method public void setAnimation(android.view.animation.Animation);
@@ -23126,6 +23127,17 @@ package android.view {
2312623127
field public static android.util.Property Y;
2312723128
}
2312823129

23130+
public static class View.AccessibilityDelegate {
23131+
ctor public View.AccessibilityDelegate();
23132+
method public boolean dispatchPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
23133+
method public void onInitializeAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
23134+
method public void onInitializeAccessibilityNodeInfo(android.view.View, android.view.accessibility.AccessibilityNodeInfo);
23135+
method public void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
23136+
method public boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent);
23137+
method public void sendAccessibilityEvent(android.view.View, int);
23138+
method public void sendAccessibilityEventUnchecked(android.view.View, android.view.accessibility.AccessibilityEvent);
23139+
}
23140+
2312923141
public static class View.BaseSavedState extends android.view.AbsSavedState {
2313023142
ctor public View.BaseSavedState(android.os.Parcel);
2313123143
ctor public View.BaseSavedState(android.os.Parcelable);

0 commit comments

Comments
 (0)