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


Java AccessibilityNodeInfo.AccessibilityAction方法代码示例

本文整理汇总了Java中android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfo.AccessibilityAction方法的具体用法?Java AccessibilityNodeInfo.AccessibilityAction怎么用?Java AccessibilityNodeInfo.AccessibilityAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.accessibility.AccessibilityNodeInfo的用法示例。


在下文中一共展示了AccessibilityNodeInfo.AccessibilityAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: withUsageHintOnClick

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static Matcher<? super View> withUsageHintOnClick(final Matcher<? extends CharSequence> charSequenceMatcher) {
    return new TypeSafeMatcher<View>() {
        @Override
        protected boolean matchesSafely(View view) {
            if (!view.isClickable()) {
                return false;
            }
            AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(view, AccessibilityNodeInfo.ACTION_CLICK);
            return charSequenceMatcher.matches(clickAction.getLabel());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("is clickable and has custom usage hint for ACTION_CLICK: ");
            charSequenceMatcher.describeTo(description);
        }
    };
}
 
开发者ID:novoda,项目名称:espresso-support,代码行数:20,代码来源:AccessibilityViewMatchers.java

示例2: withUsageHintOnLongClick

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static Matcher<? super View> withUsageHintOnLongClick(final Matcher<? extends CharSequence> charSequenceMatcher) {
    return new TypeSafeMatcher<View>() {
        @Override
        protected boolean matchesSafely(View view) {
            if (!view.isLongClickable()) {
                return false;
            }
            AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(view, AccessibilityNodeInfo.ACTION_LONG_CLICK);
            return charSequenceMatcher.matches(clickAction.getLabel());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("is long clickable and has custom usage hint for ACTION_LONG_CLICK: ");
            charSequenceMatcher.describeTo(description);
        }
    };
}
 
开发者ID:novoda,项目名称:espresso-support,代码行数:20,代码来源:AccessibilityViewMatchers.java

示例3: findAction

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static AccessibilityNodeInfo.AccessibilityAction findAction(View view, int actionId) {
    AccessibilityNodeInfo accessibilityNodeInfo = view.createAccessibilityNodeInfo();
    for (AccessibilityNodeInfo.AccessibilityAction accessibilityAction : accessibilityNodeInfo.getActionList()) {
        if (actionId == accessibilityAction.getId()) {
            return accessibilityAction;
        }
    }
    throw new AccessibilityActionNotFoundException(actionId);
}
 
开发者ID:novoda,项目名称:espresso-support,代码行数:11,代码来源:AccessibilityViewMatchers.java


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