Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. }
  2.  
  3. private static Matcher<View> childAtPosition(
  4. final Matcher<View> parentMatcher, final int position) {
  5.  
  6. return new TypeSafeMatcher<View>() {
  7. @Override
  8. public void describeTo(Description description) {
  9. description.appendText("Child at position " + position + " in parent ");
  10. parentMatcher.describeTo(description);
  11. }
  12.  
  13. @Override
  14. public boolean matchesSafely(View view) {
  15. ViewParent parent = view.getParent();
  16. return parent instanceof ViewGroup && parentMatcher.matches(parent)
  17. && view.equals(((ViewGroup) parent).getChildAt(position));
  18. }
  19. };
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement