use of com.waz.zclient.ui.views.e2ee.OtrSwitch in project wire-android by wireapp.
the class CustomMatchers method otrSwitchWithId.
public static Matcher<View> otrSwitchWithId(final int id) {
return new TypeSafeMatcher<View>() {
Resources resources = null;
@Override
public void describeTo(Description description) {
String idDescription = Integer.toString(id);
if (resources != null) {
try {
idDescription = resources.getResourceName(id);
} catch (Resources.NotFoundException e) {
// No big deal, will just use the int value.
idDescription = String.format("%s (resource name not found)", id);
}
}
description.appendText("with id: " + idDescription);
}
@Override
public boolean matchesSafely(View view) {
resources = view.getResources();
ViewParent parent = view.getParent();
return parent != null && parent instanceof OtrSwitch && id == ((OtrSwitch) parent).getId() && view instanceof SwitchCompat;
}
};
}
Aggregations