当前位置: 首页>>代码示例>>Java>>正文


Java GeneralClickAction类代码示例

本文整理汇总了Java中android.support.test.espresso.action.GeneralClickAction的典型用法代码示例。如果您正苦于以下问题:Java GeneralClickAction类的具体用法?Java GeneralClickAction怎么用?Java GeneralClickAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GeneralClickAction类属于android.support.test.espresso.action包,在下文中一共展示了GeneralClickAction类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clickDescendantViewWithId

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
/**
 * Returns an action that clicks a descendant of the view matched with the given resource id.
 *
 * @param id resource id of the view to click.
 * @return an action that clicks a descendant of the view matched with the given resource id.
 */
public static ViewAction clickDescendantViewWithId(@IdRes final int id) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return hasDescendant(withId(id));
        }

        @Override
        public String getDescription() {
            return "Click on a descendant view with id: " + id;
        }

        @Override
        public void perform(UiController uiController, View view) {
            GeneralClickAction action = new GeneralClickAction(Tap.SINGLE, GeneralLocation.VISIBLE_CENTER, Press.FINGER);
            View target = view.findViewById(id);
            // getConstraints() guarantees that the target never be null.
            action.perform(uiController, target);
        }
    };
}
 
开发者ID:sumio,项目名称:espresso-commons,代码行数:29,代码来源:RecyclerViewUtils.java

示例2: clickDescendantViewWithId

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
/**
 * Returns an action that clicks a descendant of the view matched with the given resource id.
 */
public static ViewAction clickDescendantViewWithId(@IdRes final int id) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return hasDescendant(withId(id));
        }

        @Override
        public String getDescription() {
            return "Click on a descendant view with id: " + id;
        }

        @Override
        public void perform(UiController uiController, View view) {
            GeneralClickAction action = new GeneralClickAction(Tap.SINGLE, GeneralLocation.VISIBLE_CENTER, Press.FINGER);
            View target = view.findViewById(id);
            // getConstraints() guarantees that the target never be null.
            action.perform(uiController, target);
        }
    };
}
 
开发者ID:sumio,项目名称:espresso-sample-for-droidkaigi2017,代码行数:26,代码来源:RecyclerViewUtils.java

示例3: clickXY

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
/**
 * Custom ViewAction to click on dedicated coordinates
 * @param x -
 * @param y -
 * @return ViewAction -
 */
private ViewAction clickXY( final int x, final int y ){
    return new GeneralClickAction(
            Tap.SINGLE,
            new CoordinatesProvider() {
                @Override
                public float[] calculateCoordinates( View view ){

                    final int[] screenPos = new int[2];
                    view.getLocationOnScreen(screenPos);

                    final float screenX = screenPos[0] + x;
                    final float screenY = screenPos[1] + y;

                    return new float[]{screenX, screenY};

                }
            },
            Press.FINGER);
}
 
开发者ID:pylapp,项目名称:SmoothClicker,代码行数:26,代码来源:ItSelectMultiPointsActivity.java

示例4: clickXY

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
private static ViewAction clickXY(final int x, final int y) {
    return new GeneralClickAction(
            Tap.SINGLE,
            new CoordinatesProvider() {
                @Override
                public float[] calculateCoordinates(View view) {

                    final int[] screenPos = new int[2];
                    view.getLocationOnScreen(screenPos);

                    final float screenX = screenPos[0] + x;
                    final float screenY = screenPos[1] + y;
                    float[] coordinates = {screenX, screenY};

                    return coordinates;
                }
            },
            Press.FINGER);
}
 
开发者ID:LeoSko,项目名称:Todo.txt-gDrive,代码行数:20,代码来源:MainActivityTest.java

示例5: clickXY

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public static ViewAction clickXY(final int x, final int y){
    return new GeneralClickAction(
            Tap.SINGLE,
            new CoordinatesProvider() {
                @Override
                public float[] calculateCoordinates(View view) {

                    final int[] screenPos = new int[2];
                    view.getLocationOnScreen(screenPos);

                    final float screenX = screenPos[0] + x;
                    final float screenY = screenPos[1] + y;
                    float[] coordinates = {screenX, screenY};

                    return coordinates;
                }
            },
            Press.FINGER);
}
 
开发者ID:WycliffeAssociates,项目名称:translationRecorder,代码行数:20,代码来源:TestUtils.java

示例6: clickPercent

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public static ViewAction clickPercent(final float pctX, final float pctY) {
    return new GeneralClickAction(
            Tap.SINGLE,
            view -> {

                final int[] screenPos = new int[2];
                view.getLocationOnScreen(screenPos);
                int w = view.getWidth();
                int h = view.getHeight();

                float x = w * pctX;
                float y = h * pctY;

                final float screenX = screenPos[0] + x;
                final float screenY = screenPos[1] + y;

                return new float[]{screenX, screenY};
            },
            Press.FINGER);
}
 
开发者ID:akvo,项目名称:akvo-caddisfly,代码行数:21,代码来源:TestUtil.java

示例7: clickXY

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public static ViewAction clickXY(final int x, final int y){
    return new GeneralClickAction(
            Tap.SINGLE,
            getCoordinatesProvider(x, y),
            Press.FINGER);
}
 
开发者ID:cuplv,项目名称:ChimpCheck,代码行数:7,代码来源:ChimpActionFactory.java

示例8: longClickXY

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public static ViewAction longClickXY(final int x, final int y){
    return new GeneralClickAction(
            Tap.LONG,
            getCoordinatesProvider(x, y),
            Press.FINGER);
}
 
开发者ID:cuplv,项目名称:ChimpCheck,代码行数:7,代码来源:ChimpActionFactory.java

示例9: clickOnTop

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public static ViewAction clickOnTop() {
    return new GeneralClickAction(Tap.SINGLE, GeneralLocation.TOP_CENTER, Press.FINGER);
}
 
开发者ID:zawadz88,项目名称:material-activity-chooser,代码行数:4,代码来源:ViewActions.java

示例10: clickOnChild

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public static ViewAction clickOnChild(int childViewId) {
    return actionWithAssertions((new ChildClickAction(
            new GeneralClickAction(Tap.SINGLE, GeneralLocation.VISIBLE_CENTER, Press.FINGER),
            childViewId)));
}
 
开发者ID:ribot,项目名称:easy-adapter,代码行数:6,代码来源:CustomViewActions.java

示例11: ChildClickAction

import android.support.test.espresso.action.GeneralClickAction; //导入依赖的package包/类
public ChildClickAction(GeneralClickAction generalClickAction, int childViewId) {
    mGeneralClickAction = generalClickAction;
    mChildViewId = childViewId;
}
 
开发者ID:ribot,项目名称:easy-adapter,代码行数:5,代码来源:CustomViewActions.java


注:本文中的android.support.test.espresso.action.GeneralClickAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。