Example usage for android.view.accessibility AccessibilityNodeInfo isClickable

List of usage examples for android.view.accessibility AccessibilityNodeInfo isClickable

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityNodeInfo isClickable.

Prototype

public boolean isClickable() 

Source Link

Document

Gets whether this node is clickable.

Usage

From source file:Main.java

public static AccessibilityNodeInfo findClickableNode(AccessibilityNodeInfo info) {
    if (info == null) {
        return null;
    }/*from ww  w .  j a  v a 2 s .co  m*/
    if (info.isClickable()) {
        return info;
    } else {
        return findClickableNode(info.getParent());
    }
}

From source file:Main.java

public static void performClick(AccessibilityNodeInfo nodeInfo) {
    if (nodeInfo == null) {
        return;// ww w . ja  v a2s  .  c  o m
    }
    if (nodeInfo.isClickable()) {
        nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
    } else {
        performClick(nodeInfo.getParent());
    }
}

From source file:com.linroid.pushapp.service.ApkAutoInstallService.java

/**
 * ?//  w  ww  . j  a va 2s  . co  m
 *
 * @param node
 * @return ??
 */
private boolean performClick(AccessibilityNodeInfo node) {
    return node != null && node.isEnabled() && node.isClickable()
            && node.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}

From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java

private void performWaitCheckIn() {

    AccessibilityNodeInfo mAccessibilityNodeInfo = this.getRootInActiveWindow();
    if (mAccessibilityNodeInfo == null)
        return;//from   ww  w  .  j av  a  2 s  .c o  m
    List<AccessibilityNodeInfo> mNodeInfos = mAccessibilityNodeInfo
            .findAccessibilityNodeInfosByViewId(HOME_BOTTOM_WORK_ID);
    if (mNodeInfos == null || mNodeInfos.isEmpty())
        return;
    /*?Bottom*/
    AccessibilityNodeInfo mNodeInfoBottomWork = mNodeInfos.get(0);
    if (mNodeInfoBottomWork.isClickable()) {
        mNodeInfoBottomWork.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        CURRENT_PAGER = TCN_PAGER;
    }

}

From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java

private void doQuit() {
    AccessibilityNodeInfo mAccessibilityNodeInfo = findById(CONFIRM_QUIT_ID);
    if (mAccessibilityNodeInfo != null && mAccessibilityNodeInfo.isClickable()) {
        STATE = STATE_RELEASE;//from   w  w w.j  a v  a2  s  . c o m
        mAccessibilityNodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        isChecking = false;
        if (mAccountEntities == null)
            return;
        if (index >= mAccountEntities.size()) {
            String[] hm = DateUtils.getHourAndMin(System.currentTimeMillis()).split(":");
            if (Integer.parseInt(hm[0]) > TIME_LIMIT) {
                index = 0;
                targetCheckInAcount = mAccountEntities.get(index++);
            }
            closeHelperService();
            return;
        }

        doScript();

        if (STATE == STATE_UNCHECKED_IN) {
            toSignIn();
        }

    }
}

From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java

/**
 *
 *///from   ww w .  j a  v  a2s  .c om
public void recycle(AccessibilityNodeInfo info, String target, boolean isClickSelft) {
    int temp = 0;
    if (info != null && info.getChildCount() == 0) {
        if (info.getContentDescription() != null && info.getContentDescription().toString().equals(target)
                && isClickSelft) {

            String content = info.getContentDescription().toString();
            info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            if (content.equals(AFTER_WORK))
                handleIt(info);
            else if (content.equals(GO_TO_WORK))
                handleGoToWork(info);
            return;
        }
        if (info.getText() != null) {
            if (target.equals(info.getText().toString())) {
                if (isClickSelft) {
                    info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                    return;
                }
                AccessibilityNodeInfo parent = info.getParent();
                while (parent != null) {
                    if (parent.isClickable()) {
                        parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                        break;
                    }
                    parent = parent.getParent();
                }
            }

        }
    } else {

        for (int i = 0; info != null && i < info.getChildCount(); i++) {
            if (info.getChild(i) != null) {
                temp = i;
                recycle(info.getChild(i), target, isClickSelft);
            }
        }
    }
}

From source file:com.google.android.apps.common.testing.accessibility.framework.uielement.ViewHierarchyElement.java

ViewHierarchyElement(int id, @Nullable ViewHierarchyElement parent, AccessibilityNodeInfo fromInfo) {
    // Bookkeeping
    this.id = id;
    this.parentId = (parent != null) ? parent.getId() : null;

    // API 18+ properties
    this.resourceName = AT_18 ? fromInfo.getViewIdResourceName() : null;
    this.editable = AT_18 ? fromInfo.isEditable() : null;

    // API 16+ properties
    this.visibleToUser = AT_16 ? fromInfo.isVisibleToUser() : null;

    // Base properties
    this.className = fromInfo.getClassName();
    this.packageName = fromInfo.getPackageName();
    this.accessibilityClassName = fromInfo.getClassName();
    this.contentDescription = SpannableString.valueOf(fromInfo.getContentDescription());
    this.text = SpannableString.valueOf(fromInfo.getText());
    this.importantForAccessibility = true;
    this.clickable = fromInfo.isClickable();
    this.longClickable = fromInfo.isLongClickable();
    this.focusable = fromInfo.isFocusable();
    this.scrollable = fromInfo.isScrollable();
    this.canScrollForward = ((fromInfo.getActions() & AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) != 0);
    this.canScrollBackward = ((fromInfo.getActions() & AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) != 0);
    this.checkable = fromInfo.isCheckable();
    this.checked = fromInfo.isChecked();
    this.hasTouchDelegate = false; /* Touch delegates are not considered by AccessibilityServices */
    android.graphics.Rect tempRect = new android.graphics.Rect();
    fromInfo.getBoundsInScreen(tempRect);
    this.boundsInScreen = new Rect(tempRect);
    this.nonclippedHeight = null; /* AccessibilityServices cannot discover nonclipped dimensions */
    this.nonclippedWidth = null; /* AccessibilityServices cannot discover nonclipped dimensions */
    this.textSize = null;
    this.textColor = null;
    this.backgroundDrawableColor = null;
    this.typefaceStyle = null;
    this.enabled = fromInfo.isEnabled();
}

From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java

private CharSequence formatNode(AccessibilityNodeInfo node) {
    StringBuilder sb = new StringBuilder();
    sb.append(node.getWindowId());//from  w  w  w .ja v  a 2 s .c o m
    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());
    }
    if (node.getContentDescription() != null) {
        sb.append(":");
        sb.append(node.getContentDescription());
    }
    int actions = node.getActions();
    if (actions != 0) {
        sb.append(":");
        if ((actions & AccessibilityNodeInfo.ACTION_FOCUS) != 0) {
            sb.append("F");
        }
        if ((actions & AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) != 0) {
            sb.append("A");
        }
        if ((actions & AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS) != 0) {
            sb.append("a");
        }
        if ((actions & AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) != 0) {
            sb.append("-");
        }
        if ((actions & AccessibilityNodeInfo.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();
}