Example usage for android.support.v4.view.accessibility AccessibilityNodeInfoCompat isLongClickable

List of usage examples for android.support.v4.view.accessibility AccessibilityNodeInfoCompat isLongClickable

Introduction

In this page you can find the example usage for android.support.v4.view.accessibility AccessibilityNodeInfoCompat isLongClickable.

Prototype

public boolean isLongClickable() 

Source Link

Document

Gets whether this node is long clickable.

Usage

From source file:Main.java

/**
 * Returns whether a node is long clickable. That is, the node supports at least one of the
 * following://from   ww  w  .  jav a 2  s. c  o m
 * <ul>
 * <li>{@link AccessibilityNodeInfoCompat#isLongClickable()}</li>
 * <li>{@link AccessibilityNodeInfoCompat#ACTION_LONG_CLICK}</li>
 * </ul>
 *
 * @param node The node to examine.
 * @return {@code true} if node is long clickable.
 */
public static boolean isLongClickable(AccessibilityNodeInfoCompat node) {
    if (node == null) {
        return false;
    }

    if (node.isLongClickable()) {
        return true;
    }

    return supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
}

From source file:Main.java

/**
 * Returns whether a node is actionable. That is, the node supports one of
 * {@link AccessibilityNodeInfoCompat#isClickable()},
 * {@link AccessibilityNodeInfoCompat#isFocusable()}, or
 * {@link AccessibilityNodeInfoCompat#isLongClickable()}.
 *
 * @param node The {@link AccessibilityNodeInfoCompat} to evaluate
 * @return {@code true} if node is actionable.
 *//*from ww w  .  j a v  a2s .c o  m*/
public static boolean isActionableForAccessibility(@Nullable AccessibilityNodeInfoCompat node) {
    if (node == null) {
        return false;
    }

    if (node.isClickable() || node.isLongClickable() || node.isFocusable()) {
        return true;
    }

    List actionList = node.getActionList();
    return actionList.contains(AccessibilityNodeInfoCompat.ACTION_CLICK)
            || actionList.contains(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK)
            || actionList.contains(AccessibilityNodeInfoCompat.ACTION_FOCUS);
}

From source file:com.android.utils.AccessibilityNodeInfoUtils.java

/**
 * Returns whether a node is long clickable. That is, the node supports at least one of the
 * following:/*from   www . j a v  a 2s.c om*/
 * <ul>
 * <li>{@link AccessibilityNodeInfoCompat#isLongClickable()}</li>
 * <li>{@link AccessibilityNodeInfoCompat#ACTION_LONG_CLICK}</li>
 * </ul>
 *
 * @param node The node to examine.
 * @return {@code true} if node is long clickable.
 */
public static boolean isLongClickable(AccessibilityNodeInfoCompat node) {
    return node != null && (node.isLongClickable()
            || supportsAnyAction(node, AccessibilityNodeInfoCompat.ACTION_LONG_CLICK));

}

From source file:com.googlecode.eyesfree.utils.TreeDebug.java

/**
 * Gets a description of the properties of a node.
 *//*from  w w  w.j  a v a  2s  .  c o  m*/
public static CharSequence nodeDebugDescription(AccessibilityNodeInfoCompat node) {
    StringBuilder sb = new StringBuilder();
    sb.append(node.getWindowId());

    if (node.getClassName() != null) {
        appendSimpleName(sb, node.getClassName());
    } else {
        sb.append("??");
    }

    if (!node.isVisibleToUser()) {
        sb.append(":invisible");
    }

    if (node.getText() != null) {
        sb.append(":");
        sb.append(node.getText().toString().trim());
    }

    if (node.getContentDescription() != null) {
        sb.append(":");
        sb.append(node.getContentDescription().toString().trim());
    }

    int actions = node.getActions();
    if (actions != 0) {
        sb.append(":");
        if ((actions & AccessibilityNodeInfoCompat.ACTION_FOCUS) != 0) {
            sb.append("F");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS) != 0) {
            sb.append("A");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS) != 0) {
            sb.append("a");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD) != 0) {
            sb.append("-");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD) != 0) {
            sb.append("+");
        }
    }

    if (node.isCheckable()) {
        sb.append(":");
        if (node.isChecked()) {
            sb.append("(X)");
        } else {
            sb.append("( )");
        }
    }

    if (node.isFocusable()) {
        sb.append(":focusable");
    }

    if (node.isFocused()) {
        sb.append(":focused");
    }

    if (node.isSelected()) {
        sb.append(":selected");
    }

    if (node.isClickable()) {
        sb.append(":clickable");
    }

    if (node.isLongClickable()) {
        sb.append(":longClickable");
    }

    if (node.isAccessibilityFocused()) {
        sb.append(":accessibilityFocused");
    }

    if (!node.isEnabled()) {
        sb.append(":disabled");
    }

    return sb.toString();
}

From source file:com.android.utils.TreeDebug.java

/**
 * Gets a description of the properties of a node.
 *///from   w  ww.  j  ava  2  s  .co  m
private static CharSequence nodeDebugDescription(AccessibilityNodeInfoCompat node) {
    StringBuilder sb = new StringBuilder();
    sb.append(node.getWindowId());

    if (node.getClassName() != null) {
        appendSimpleName(sb, node.getClassName());
    } else {
        sb.append("??");
    }

    if (!node.isVisibleToUser()) {
        sb.append(":invisible");
    }

    Rect rect = new Rect();
    node.getBoundsInScreen(rect);
    sb.append(":");
    sb.append("(").append(rect.left).append(", ").append(rect.top).append(" - ").append(rect.right).append(", ")
            .append(rect.bottom).append(")");

    if (node.getText() != null) {
        sb.append(":");
        sb.append(node.getText().toString().trim());
    }

    if (node.getContentDescription() != null) {
        sb.append(":");
        sb.append(node.getContentDescription().toString().trim());
    }

    int actions = node.getActions();
    if (actions != 0) {
        sb.append(":");
        if ((actions & AccessibilityNodeInfoCompat.ACTION_FOCUS) != 0) {
            sb.append("F");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS) != 0) {
            sb.append("A");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS) != 0) {
            sb.append("a");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD) != 0) {
            sb.append("-");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_CLICK) != 0) {
            sb.append("C");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_LONG_CLICK) != 0) {
            sb.append("L");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD) != 0) {
            sb.append("+");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_EXPAND) != 0) {
            sb.append("e");
        }
        if ((actions & AccessibilityNodeInfoCompat.ACTION_COLLAPSE) != 0) {
            sb.append("c");
        }
    }

    if (node.isCheckable()) {
        sb.append(":");
        if (node.isChecked()) {
            sb.append("(X)");
        } else {
            sb.append("( )");
        }
    }

    if (node.isFocusable()) {
        sb.append(":focusable");
    }

    if (node.isFocused()) {
        sb.append(":focused");
    }

    if (node.isSelected()) {
        sb.append(":selected");
    }

    if (node.isClickable()) {
        sb.append(":clickable");
    }

    if (node.isLongClickable()) {
        sb.append(":longClickable");
    }

    if (node.isAccessibilityFocused()) {
        sb.append(":accessibilityFocused");
    }

    if (!node.isEnabled()) {
        sb.append(":disabled");
    }

    if (node.getCollectionInfo() != null) {
        sb.append(":collection");
        sb.append("#R");
        sb.append(node.getCollectionInfo().getRowCount());
        sb.append("C");
        sb.append(node.getCollectionInfo().getColumnCount());
    }

    if (node.getCollectionItemInfo() != null) {
        if (node.getCollectionItemInfo().isHeading()) {
            sb.append(":heading");
        } else {
            sb.append(":item");
        }

        sb.append("#r");
        sb.append(node.getCollectionItemInfo().getRowIndex());
        sb.append("c");
        sb.append(node.getCollectionItemInfo().getColumnIndex());
    }

    return sb.toString();
}