use of com.beloo.widget.chipslayoutmanager.ChildViewsIterable in project ChipsLayoutManager by BelooS.
the class RecyclerViewEspressoFactory method orderMatcher.
///////////////////////////////////////////////////////////////////////////
// Matcher
///////////////////////////////////////////////////////////////////////////
private static Matcher<View> orderMatcher() {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("with correct position order");
}
@Override
public boolean matchesSafely(View v) {
RecyclerView view = (RecyclerView) v;
if (view.getLayoutManager() == null)
return false;
ChildViewsIterable childViews = new ChildViewsIterable(view.getLayoutManager());
int pos = view.getChildAdapterPosition(childViews.iterator().next());
for (View child : childViews) {
if (pos != view.getChildAdapterPosition(child)) {
return false;
}
pos++;
}
return true;
}
};
}
Aggregations