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


Java AccessibilityNodeInfoCompat.ACTION_LONG_CLICK属性代码示例

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


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

示例1: getAction

private String getAction() {
    switch (mAction) {
        case AccessibilityNodeInfoCompat.ACTION_CLICK:
            return "click()";
        case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK:
            return "longClick()";

        case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
            return "scrollBackward()";

        case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
            return "scrollForward()";

        case AccessibilityNodeInfoCompat.ACTION_SET_TEXT:
            return "setText(\"\")";
    }
    return "";
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:18,代码来源:CodeGenerator.java

示例2: performActionForKey

/**
 * Performs the specified accessibility action for the given key.
 *
 * @param key The on which to perform the action.
 * @param action The action to perform.
 * @return The result of performing the action, or false if the action is not supported.
 */
boolean performActionForKey(final Key key, final int action) {
    switch (action) {
    case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
        mAccessibilityFocusedView = getVirtualViewIdOf(key);
        sendAccessibilityEventForKey(
                key, AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
        return true;
    case AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS:
        mAccessibilityFocusedView = UNDEFINED;
        sendAccessibilityEventForKey(
                key, AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
        return true;
    case AccessibilityNodeInfoCompat.ACTION_CLICK:
        sendAccessibilityEventForKey(key, AccessibilityEvent.TYPE_VIEW_CLICKED);
        mDelegate.performClickOn(key);
        return true;
    case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK:
        sendAccessibilityEventForKey(key, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
        mDelegate.performLongClickOn(key);
        return true;
    default:
        return false;
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:31,代码来源:KeyboardAccessibilityNodeProvider.java

示例3: performAccessibilityAction

@Override
public boolean performAccessibilityAction(View host, int action,
		Bundle arguments) {
	if (super.performAccessibilityAction(host, action, arguments)) {
		return true;
	}

	final int position = getPositionForView(host);
	final ListAdapter adapter = getAdapter();

	if ((position == INVALID_POSITION) || (adapter == null)) {
		// Cannot perform actions on invalid items.
		return false;
	}

	if (!isEnabled() || !adapter.isEnabled(position)) {
		// Cannot perform actions on disabled items.
		return false;
	}

	final long id = getItemIdAtPosition(position);

	switch (action) {
	case AccessibilityNodeInfoCompat.ACTION_CLEAR_SELECTION: {
		if (getSelectedItemPosition() == position) {
			setSelection(INVALID_POSITION);
			return true;
		}
	}
		return false;
	case AccessibilityNodeInfoCompat.ACTION_SELECT: {
		if (getSelectedItemPosition() != position) {
			setSelection(position);
			return true;
		}
	}
		return false;
	case AccessibilityNodeInfoCompat.ACTION_CLICK: {
		if (isClickable()) {
			return performItemClick(host, position, id);
		}
	}
		return false;
	case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK: {
		if (isLongClickable()) {
			return performLongPress(host, position, id);
		}
	}
		return false;
	}

	return false;
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:53,代码来源:AbsHListView.java


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