use of android.support.test.espresso.UiController in project material-components-android by material-components.
the class TextInputLayoutActions method setCounterMaxLength.
public static ViewAction setCounterMaxLength(final int maxLength) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isAssignableFrom(TextInputLayout.class);
}
@Override
public String getDescription() {
return "Sets the counter max length";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
TextInputLayout layout = (TextInputLayout) view;
layout.setCounterMaxLength(maxLength);
uiController.loopMainThreadUntilIdle();
}
};
}
use of android.support.test.espresso.UiController in project material-components-android by material-components.
the class TextInputLayoutActions method setPasswordVisibilityToggleEnabled.
public static ViewAction setPasswordVisibilityToggleEnabled(final boolean enabled) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isAssignableFrom(TextInputLayout.class);
}
@Override
public String getDescription() {
return "Sets the error";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
TextInputLayout layout = (TextInputLayout) view;
layout.setPasswordVisibilityToggleEnabled(enabled);
uiController.loopMainThreadUntilIdle();
}
};
}
use of android.support.test.espresso.UiController in project material-components-android by material-components.
the class TextInputLayoutActions method setTypeface.
public static ViewAction setTypeface(final Typeface typeface) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isAssignableFrom(TextInputLayout.class);
}
@Override
public String getDescription() {
return "Sets the typeface";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
TextInputLayout layout = (TextInputLayout) view;
layout.setTypeface(typeface);
uiController.loopMainThreadUntilIdle();
}
};
}
use of android.support.test.espresso.UiController in project material-components-android by material-components.
the class TextInputLayoutActions method setError.
public static ViewAction setError(final CharSequence error) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isAssignableFrom(TextInputLayout.class);
}
@Override
public String getDescription() {
return "Sets the error";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
TextInputLayout layout = (TextInputLayout) view;
layout.setError(error);
uiController.loopMainThreadUntilIdle();
}
};
}
use of android.support.test.espresso.UiController in project material-components-android by material-components.
the class ViewPagerActions method scrollToPage.
/** Moves <code>ViewPager</code> to specific page. */
public static ViewAction scrollToPage(final int page) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isDisplayingAtLeast(90);
}
@Override
public String getDescription() {
return "ViewPager move to a specific page";
}
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
ViewPager viewPager = (ViewPager) view;
viewPager.setCurrentItem(page, false);
uiController.loopMainThreadUntilIdle();
}
};
}
Aggregations