@@ -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 );
@@ -199,6 +203,12 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) {
199
203
mFocusedObject = object ;
200
204
return true ;
201
205
}
206
+ // TODO(goderbauer): Use ACTION_SHOW_ON_SCREEN from Android Support Library after
207
+ // https://github.com/flutter/flutter/issues/11099 is resolved.
208
+ case 16908342 : { // ACTION_SHOW_ON_SCREEN, added in API level 23
209
+ mOwner .dispatchSemanticsAction (virtualViewId , SEMANTICS_ACTION_SHOW_ON_SCREEN );
210
+ return true ;
211
+ }
202
212
}
203
213
return false ;
204
214
}
0 commit comments