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