Java Code Examples for android.support.test.espresso.matcher.ViewMatchers#isAssignableFrom()

The following examples show how to use android.support.test.espresso.matcher.ViewMatchers#isAssignableFrom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppBarLayoutAction.java    From espresso-macchiato with MIT License 6 votes vote down vote up
public static ViewAction collapse() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(AppBarLayout.class);
        }

        @Override
        public String getDescription() {
            return "Collapse AppBarLayout inside of a CollapsingToolbarLayout.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            AppBarLayout appBarLayout = (AppBarLayout) view;
            appBarLayout.setExpanded(false, false);
        }
    };
}
 
Example 2
Source File: AppBarLayoutAction.java    From espresso-macchiato with MIT License 6 votes vote down vote up
public static ViewAction expand() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(AppBarLayout.class);
        }

        @Override
        public String getDescription() {
            return "Expand AppBarLayout inside of a CollapsingToolbarLayout.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            AppBarLayout appBarLayout = (AppBarLayout) view;
            appBarLayout.setExpanded(true, false);
        }
    };
}
 
Example 3
Source File: Step4CalculatorActivityTest.java    From android-agera with Apache License 2.0 6 votes vote down vote up
public static ViewAction setProgress(int progress) {
    return new ViewAction() {
        @Override
        public void perform(UiController uiController, View view) {
            SeekBar seekBar = (SeekBar) view;
            seekBar.setProgress(progress);
        }
        @Override
        public String getDescription() {
            return "Set a progress on a SeekBar";
        }
        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(SeekBar.class);
        }
    };
}
 
Example 4
Source File: Step4CalculatorActivityFinalTest.java    From android-agera with Apache License 2.0 6 votes vote down vote up
public static ViewAction setProgress(int progress) {
    return new ViewAction() {
        @Override
        public void perform(UiController uiController, View view) {
            SeekBar seekBar = (SeekBar) view;
            seekBar.setProgress(progress);
        }
        @Override
        public String getDescription() {
            return "Set a progress on a SeekBar";
        }
        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(SeekBar.class);
        }
    };
}