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


Java AccessibilityNodeInfo.getChild方法代码示例

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


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

示例1: iteratorSMZDM

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void iteratorSMZDM(AccessibilityNodeInfo info) {
    if (info.getChildCount() == 0 && info.getText() != null) {
        if (info.getText().equals("签到")) {
            AccessibilityNodeInfo parent = info.getParent();
            if ("android.widget.RelativeLayout".equals(parent.getClassName())
                    && parent.isClickable()) {
                parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                found = true;
                return;
            }
        }
    } else {
        for (int i = 0; i < info.getChildCount(); i++) {
            if(info.getChild(i)!=null){
                if (found) {
                    found = false;
                    break;
                }
                iteratorSMZDM(info.getChild(i));
            }
        }
    }
    return ;
}
 
开发者ID:Sl0v3C,项目名称:Android_AutoSignInTool,代码行数:25,代码来源:autoSignInSMZDM.java

示例2: iteratorTXDM

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void iteratorTXDM(AccessibilityNodeInfo info, AccessibilityService service) {
    List<AccessibilityNodeInfo> node  = info.findAccessibilityNodeInfosByViewId("com.qq.ac.android:id/tab_layout_center");
    if (node != null) {
        AccessibilityNodeInfo find = node.get(0);
        if ("android.widget.RelativeLayout".equals(find.getClassName())
                && find.isClickable()) {
            find.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            delay(3000);
            iterator(service.getRootInActiveWindow(), service);
            found = true;
            return;
        }

    } else {
        for (int i = 0; i < info.getChildCount(); i++) {
            if(info.getChild(i)!=null){
                if (found) {
                    found = false;
                    break;
                }
                iteratorTXDM(info.getChild(i), service);
            }
        }
    }
    return ;
}
 
开发者ID:Sl0v3C,项目名称:Android_AutoSignInTool,代码行数:27,代码来源:autoSignInTXDM.java

示例3: crawlButton

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
    * 爬遍所有节点查找可点的按钮,用于解决Android5.1等组件层次分离的情况
    * @param root 界面根节点
    */
   void crawlButton(AccessibilityNodeInfo root)
   {
AccessibilityNodeInfo child;
Integer size = root.getChildCount();
for (Integer i=0;i < size;i++)
{
    child = root.getChild(i);
    if (child != null)
    {
	if (child.getClassName().toString().equals("android.widget.Button"))
	{
	    //  Log.d("crawl-button", child.toString());
	    //Log.d("click", "OPEN");
	    child.performAction(AccessibilityNodeInfo.ACTION_CLICK); // 拆红包
	    cnt_open += 1;
	    flags_detail = 1; // 红包有效
	    state = State.DETAIL;
	}
	crawlButton(child);
    }

}
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:28,代码来源:AnimatedEditText.java

示例4: iterateNodesAndHandle

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private boolean iterateNodesAndHandle(AccessibilityNodeInfo nodeInfo) {
    if (nodeInfo != null) {
        int childCount = nodeInfo.getChildCount();
        if ("android.widget.Button".equals(nodeInfo.getClassName())) {
            String nodeContent = nodeInfo.getText().toString();
           // Log.d("TAG", "content is " + nodeContent);
            if ("安装".equals(nodeContent)|| "完成".equals(nodeContent) || "确定".equals(nodeContent)) {
                nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                return true;
            }
        } else if ("android.widget.ScrollView".equals(nodeInfo.getClassName())) {
            nodeInfo.performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        }
        for (int i = 0; i < childCount; i++) {
            AccessibilityNodeInfo childNodeInfo = nodeInfo.getChild(i);
            if (iterateNodesAndHandle(childNodeInfo)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:23,代码来源:fool.java

示例5: findChildView

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void findChildView(AccessibilityNodeInfo info, String findText) {
    String text = info.getText() + "";
    boolean isContentTxl = text.equals(findText);
    if (info.getChildCount() == 0) {
        if (!TextUtils.isEmpty(text) && isContentTxl) {
            L.e("Text:" + text + "是否" + isContentTxl + "是否2" + text.equals("通讯录"));
            performClick(info);
        }
    } else {
        for (int i = 0; i < info.getChildCount(); i++) {
            if (info.getChild(i) != null) {
                findChildView(info.getChild(i), findText);
            }
        }
    }
}
 
开发者ID:kaixuanluo,项目名称:pc-android-controller-android,代码行数:17,代码来源:AccessUtil.java

示例6: getNodePath

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static AccessibilityNodeInfo getNodePath(AccessibilityNodeInfo root,String path){
    if(path.length()<2){
        return null;
    }
    for(int i=1;i<path.length();i++){
        int childNo = Integer.parseInt(path.substring(i,i+1));
        if(root==null||childNo>=root.getChildCount()){
            return null;
        }else {
            root = root.getChild(childNo);
        }
    }
    return root;
}
 
开发者ID:brute121105,项目名称:weixin_auto,代码行数:15,代码来源:ParseRootUtil.java

示例7: iteratorJD

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void iteratorJD(AccessibilityNodeInfo info) {
    if (info.getText() != null) {
        if (info.getText().toString().contains("会员") && !info.getText().equals("PLUS会员")) {
            AccessibilityNodeInfo parent = info.getParent();
            if ("android.widget.RelativeLayout".equals(parent.getClassName())
                    && parent.isClickable()) {
                parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                found = true;
                return ;
            }
        }
        if (info.getText().equals("签到")
                && info.findAccessibilityNodeInfosByViewId("com.jd.lib.coupon:id/sign_get_button") != null
                && info.isClickable()) {
            info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            found = true;
            return;
        }
    } else {
        for (int i = 0; i < info.getChildCount(); i++) {
            if(info.getChild(i)!=null){
                if (found) {
                    found  = false;
                    break;
                }
                iteratorJD(info.getChild(i));
            }
        }
    }
    return ;
}
 
开发者ID:Sl0v3C,项目名称:Android_AutoSignInTool,代码行数:32,代码来源:autoSignInJD.java

示例8: preOrderTraverse

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * traverse a tree from the root, and return all the notes in the tree
 * @param root the root node
 * @return a list of AccessibilityNodeInfo
 */
public static List<AccessibilityNodeInfo> preOrderTraverse(AccessibilityNodeInfo root){
    if(root == null)
        return null;
    List<AccessibilityNodeInfo> list = new ArrayList<>();
    list.add(root);
    int childCount = root.getChildCount();
    for(int i = 0; i < childCount; i ++){
        AccessibilityNodeInfo node = root.getChild(i);
        if(node != null)
            list.addAll(preOrderTraverse(node));
    }
    return list;
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:19,代码来源:AccessibilityUtils.java

示例9: clickLastMsg

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/** 点最新消息 */
private boolean clickLastMsg(AccessibilityNodeInfo nodeInfo) {
    boolean isClick = false;
    AccessibilityNodeInfo listView = AccessibilityUtils.findNodeInfosById(nodeInfo, ID_LIST_CHAT);
    if(listView == null){
        return isClick;
    }
    int childCount = listView.getChildCount();
    if(childCount <= 0){
        return isClick;
    }
    AccessibilityNodeInfo item = listView.getChild(childCount - 1);
    if(item != null){ // 每一条新消息都试着点红包
        AccessibilityNodeInfo real = AccessibilityUtils.findNodeInfosById(item, ID_LIST_CHAT_ITEM_VIEW);
        if(real != null) { // 真红包

            // 新版本后, 1100(包括)以上, 能判断红包是否已经领取
            if(mService.getWeChatPackageInfo().versionCode >= WeChatConfig.V_1100){
                AccessibilityNodeInfo realToo = AccessibilityUtils.findNodeInfosByTexts(real, KEY_SEARCH, KEY_SEARCH_SELF);
                if(realToo == null){
                    return isClick;
                }
            }

            if(clickRedPacket(nodeInfo, real)){
                isReceived = isClick = true;
            }
        }else{
            isClick = false;
            LogUtils.printOut("------非红包------");
        }
    }
    return isClick;
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:35,代码来源:WeChatAccessibilityJob.java

示例10: getSenderContentDescriptionFromNode

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private String[] getSenderContentDescriptionFromNode(AccessibilityNodeInfo node) {
    int count = node.getChildCount();
    String[] result = {"unknownSender", "unknownTime"};
    for (int i = 0; i < count; i++) {
        AccessibilityNodeInfo thisNode = node.getChild(i);
        if ("android.widget.ImageView".equals(thisNode.getClassName()) && "unknownSender".equals(result[0])) {
            CharSequence contentDescription = thisNode.getContentDescription();
            if (contentDescription != null) result[0] = contentDescription.toString().replaceAll("头像$", "");
        } else if ("android.widget.TextView".equals(thisNode.getClassName()) && "unknownTime".equals(result[1])) {
            CharSequence thisNodeText = thisNode.getText();
            if (thisNodeText != null) result[1] = thisNodeText.toString();
        }
    }
    return result;
}
 
开发者ID:KoreHuang,项目名称:WeChatLuckyMoney,代码行数:16,代码来源:HongbaoSignature.java

示例11: recursiveNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * 递归遍历点击ImageButton
 *
 * @param nodeInfo
 */
private void recursiveNodeInfo(AccessibilityNodeInfo nodeInfo) {
    if (nodeInfo != null) {
        Log.d(TAG, "recursiveNodeInfo() called with: nodeInfo = [" + nodeInfo + "]");
        if ("android.widget.ImageButton".equals(nodeInfo.getClassName())) {//点击ImageButton
            nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        }
        for (int i = 0; i < nodeInfo.getChildCount(); i++) {//遍历子View
            AccessibilityNodeInfo child = nodeInfo.getChild(i);
            recursiveNodeInfo(child);
        }
    }

}
 
开发者ID:mcxtzhang,项目名称:miser-utils,代码行数:19,代码来源:ComeOnMoneyService.java

示例12: findAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/***
 * Find a matched node by tracing the tree of nodes.
 * @param source
 * @param text
 * @return
 */
public static AccessibilityNodeInfo findAccessibilityNodeInfo(AccessibilityNodeInfo source, String text) {
	AccessibilityNodeInfo accessibilityNodeInfo = null;
	if (TextUtils.isEmpty(text)) {
		return accessibilityNodeInfo;
	}
	
	for (int i = 0; i < source.getChildCount(); i++) {
		AccessibilityNodeInfo compareNode = source.getChild(i);
		if (compareNode != null && compareNode.getText() != null) {

			LogUtils.LOGD(TAG, "(findAccessibilityNodeInfo) completeNode : " + compareNode.getClassName() + ", " + compareNode.getText());

			if (text.equals(compareNode.getText())) {
				LogUtils.LOGD(TAG, "(findAccessibilityNodeInfo) Find node : " + compareNode.getClassName() + ", " + compareNode.getText());
				accessibilityNodeInfo = compareNode;
			}
			if (accessibilityNodeInfo == null) {
				accessibilityNodeInfo = findAccessibilityNodeInfo(compareNode, text);
			}
			if (accessibilityNodeInfo == null) {
				compareNode.recycle();
			} else {
				break;
			}
		}
	}
	
	return accessibilityNodeInfo;
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:36,代码来源:AppDetailsAutomatorUtil.java

示例13: findNodeAllChildren

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static void findNodeAllChildren(AccessibilityNodeInfo topNode,List<AccessibilityNodeInfo> list){
    if (topNode.getChildCount() > 0) {
        for(int i = 0;i < topNode.getChildCount();i++) {
            AccessibilityNodeInfo child = topNode.getChild(i);
            list.add(child);
            findNodeAllChildren(child,list);
        }
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:10,代码来源:AceHelper.java

示例14: iteratorJDF

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void iteratorJDF(AccessibilityNodeInfo info) {
    if (info.getText() != null) {
        if (info.getText().equals("忘记手势密码")) {
            gestureLockFlag =  true;
            return;
        }

        /*
        if (info.getText().toString().contains("钢镚明细")) {
            if (info.isClickable() && info.findAccessibilityNodeInfosByViewId("com.jd.jrapp:id/btn_feedback_summit") != null) {
                info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                found = true;
                return;
            }
        }
        */

        if (info.getText().equals("签到")) {
            AccessibilityNodeInfo parent = info.getParent();
            if (info.findAccessibilityNodeInfosByViewId("com.jd.jrapp:id/tv_item_text") != null
                    && "android.widget.RelativeLayout".equals(parent.getClassName())
                    && parent.isClickable()) {
                parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                found = true;
                return;
            }
            if (info.isClickable() && info.findAccessibilityNodeInfosByViewId("com.jd.jrapp:id/btn_feedback_summit") != null) {
                info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                found = true;
                return;
            }
        }
    } else {
        for (int i = 0; i < info.getChildCount(); i++) {
            if(info.getChild(i) != null){
                if (gestureLockFlag || found) {
                    found = false;
                    break;
                }
                iteratorJDF(info.getChild(i));
            }
        }
    }
    return ;
}
 
开发者ID:Sl0v3C,项目名称:Android_AutoSignInTool,代码行数:46,代码来源:autoSignInJDF.java

示例15: findEditText

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * 通过rootNode 填充内容
 * @param rootNode
 * @param content
 * @return
 */
private boolean findEditText(AccessibilityNodeInfo rootNode, String content) {
    int count = rootNode.getChildCount();

    for (int i = 0; i < count; i++) {
        AccessibilityNodeInfo nodeInfo = rootNode.getChild(i);
        if (nodeInfo == null) {
            continue;
        }
        if(nodeInfo.getContentDescription() != null){
            int nindex = nodeInfo.getContentDescription().toString().indexOf(name);
            int cindex = nodeInfo.getContentDescription().toString().indexOf(scontent);
            if(nindex != -1){
                itemNodeinfo = nodeInfo;
            }
        }
        if ("android.widget.EditText".equals(nodeInfo.getClassName())) {
            Bundle arguments = new Bundle();
            arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
                    AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD);
            arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
                    true);
            nodeInfo.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
                    arguments);
            nodeInfo.performAction(AccessibilityNodeInfo.ACTION_FOCUS);
            // 创建一个剪贴数据集,把content数据集放进去
            ClipData clip = ClipData.newPlainText("label", content);
            // 获取系统剪贴板
            ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            // 把数据集设置(复制)到剪贴板
            clipboardManager.setPrimaryClip(clip);
            nodeInfo.performAction(AccessibilityNodeInfo.ACTION_PASTE);
            return true;
        }

        if (findEditText(nodeInfo, content)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:xmlxin,项目名称:ReplyMessage,代码行数:48,代码来源:AutoReplyService.java


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