public static boolean isTopLevelScrollItem ( Context context , AccessibilityNodeInfoCompat node ) { if ( node == null ) { return false ; } AccessibilityNodeInfoCompat parent = null ; try { parent = node . getParent ( ) ; if ( parent == null ) { // Not a child node of anything. return false ; } if ( isScrollable ( node ) ) { return true ; } // AdapterView, ScrollView, and HorizontalScrollView are focusable // containers, but Spinner is a special case. // TODO: Rename or break up this method, since it actually returns // whether the parent is scrollable OR is a focusable container that // should not block its children from receiving focus. if ( nodeMatchesAnyClassByType ( context , parent , android . widget . AdapterView . class , android . widget . ScrollView . class , android . widget . HorizontalScrollView . class , CLASS_TOUCHWIZ_TWADAPTERVIEW ) && ! nodeMatchesAnyClassByType ( context , parent , android . widget . Spinner . class ) ) { return true ; } return false ; } finally { recycleNodes ( parent ) ; } }
Determines whether a node is a top - level item in a scrollable container .