List of usage examples for android.widget ScrollView setAccessibilityDelegate
public void setAccessibilityDelegate(@Nullable AccessibilityDelegate delegate)
From source file:com.android.switchaccess.SwitchAccessEndToEndTest.java
@MediumTest public void testScrolling_scroll() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return;//from w w w . j av a2 s . co m } final ScrollView scrollView = (ScrollView) getActivity().findViewById(R.id.scroll_id); final CountDownLatch scrollsMissed = new CountDownLatch(1); scrollView.setAccessibilityDelegate(new AccessibilityDelegate() { @Override public boolean performAccessibilityAction(@NonNull View host, int action, Bundle args) { if (action == AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD) { scrollsMissed.countDown(); } return super.performAccessibilityAction(host, action, args); } }); sendKeyEventSync(mMoveFocusEvent); sendKeyEventSync(mScrollForwardEvent); assertEquals(0, scrollsMissed.getCount()); }