/** * Determines if the supplied {@link View} has any retrievable listeners that might qualify the * view to be important for accessibility purposes. * <p> * NOTE: This method tries to behave like the hidden {@code View#hasListenersForAccessibility()} * method, but cannot retrieve several of the listeners. * * @param view The {@link View} to evaluate * @return {@code true} if any of the retrievable listeners on {@code view} might qualify it to be * important for accessibility purposes. */ private static boolean hasListenersForAccessibility(View view) { if (view == null) { return false; } boolean result = false; // Ideally, here we check for... // TouchDelegate result |= view.getTouchDelegate() != null; // OnKeyListener, OnTouchListener, OnGenericMotionListener, OnHoverListener, OnDragListener // aren't accessible to us. return result; }
private static boolean hasAncestorWithTouchDelegate(View view) { if (view == null) { return false; } View evalView = null; ViewParent parent = view.getParent(); if (parent instanceof View) { evalView = (View) parent; if (evalView.getTouchDelegate() != null) { return true; } } return hasAncestorWithTouchDelegate(evalView); } }
data.put("IsVerticalFadingEdgeEnabled", v.isVerticalFadingEdgeEnabled()); data.put("IsVerticalScrollBarEnabled", v.isVerticalScrollBarEnabled()); data.put("TouchDelegate", String.valueOf(v.getTouchDelegate())); final ArrayList<View> touchables = v.getTouchables(); data.put("TouchablesCount", touchables != null ? touchables.size() : 0);