當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。