• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GeneralClickAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SessionLogEntry类代码示例发布时间:2022-05-22
下一篇:
Java DefaultPrefixManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap