@@ -40,6 +40,7 @@ class AccessibilityBridge extends AccessibilityNodeProvider {
40
40
private static final int SEMANTICS_ACTION_SCROLL_DOWN = 1 << 5 ;
41
41
private static final int SEMANTICS_ACTION_INCREASE = 1 << 6 ;
42
42
private static final int SEMANTICS_ACTION_DECREASE = 1 << 7 ;
43
+ private static final int SEMANTICS_ACTION_SHOW_ON_SCREEN = 1 << 8 ;
43
44
44
45
private static final int SEMANTICS_ACTION_SCROLLABLE = SEMANTICS_ACTION_SCROLL_LEFT |
45
46
SEMANTICS_ACTION_SCROLL_RIGHT |
@@ -77,7 +78,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
77
78
78
79
AccessibilityNodeInfo result = AccessibilityNodeInfo .obtain (mOwner , virtualViewId );
79
80
result .setPackageName (mOwner .getContext ().getPackageName ());
80
- result .setClassName ("Flutter" ); // Prettier than the more conventional node.getClass().getName()
81
+ result .setClassName ("Flutter" ); // TODO(goderbauer): Set proper class names
81
82
result .setSource (mOwner , virtualViewId );
82
83
83
84
if (object .parent != null ) {
@@ -117,6 +118,9 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
117
118
result .addAction (AccessibilityNodeInfo .ACTION_SCROLL_FORWARD );
118
119
result .addAction (AccessibilityNodeInfo .ACTION_SCROLL_BACKWARD );
119
120
result .setScrollable (true );
121
+ // This tells Android's a11y to send scroll events when reaching the end of
122
+ // the visible viewport of a scrollable.
123
+ result .setClassName ("android.widget.ScrollView" );
120
124
}
121
125
122
126
result .setCheckable ((object .flags & SEMANTICS_FLAG_HAS_CHECKED_STATE ) != 0 );
@@ -148,6 +152,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
148
152
149
153
@ Override
150
154
public boolean performAction (int virtualViewId , int action , Bundle arguments ) {
155
+ Log .i (TAG , "action: " + action + " , node: " + virtualViewId );
151
156
SemanticsObject object = mObjects .get (virtualViewId );
152
157
if (object == null ) {
153
158
return false ;
@@ -199,6 +204,12 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) {
199
204
mFocusedObject = object ;
200
205
return true ;
201
206
}
207
+ // TODO(goderbauer): Use ACTION_SHOW_ON_SCREEN from Android Support Library after
208
+ // https://github.com/flutter/flutter/issues/11099 is resolved.
209
+ case 16908342 : { // ACTION_SHOW_ON_SCREEN, added in API level 23
210
+ mOwner .dispatchSemanticsAction (virtualViewId , SEMANTICS_ACTION_SHOW_ON_SCREEN );
211
+ return true ;
212
+ }
202
213
}
203
214
return false ;
204
215
}
0 commit comments