當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId方法代碼示例

本文整理匯總了Java中android.view.accessibility.AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId方法的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId方法的具體用法?Java AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId怎麽用?Java AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.accessibility.AccessibilityNodeInfo的用法示例。


在下文中一共展示了AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findViewIdAndClick

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
 * 檢查viewId進行點擊
 *
 * @param accessibilityService
 * @param id
 */
public static void findViewIdAndClick(AccessibilityService accessibilityService, String id) {

    AccessibilityNodeInfo accessibilityNodeInfo = accessibilityService.getRootInActiveWindow();
    if (accessibilityNodeInfo == null) {
        return;
    }

    List<AccessibilityNodeInfo> nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(id);
    if (nodeInfoList != null && !nodeInfoList.isEmpty()) {
        for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
            if (nodeInfo != null) {
                performClick(nodeInfo);
                break;
            }
        }
    }
}
 
開發者ID:xmlxin,項目名稱:ReplyMessage,代碼行數:24,代碼來源:PerformClickUtils.java

示例2: contentChange

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
 * 內容改變
 *
 * @param event
 */

private void contentChange(AccessibilityEvent event) {
    AccessibilityNodeInfo root = getRootInActiveWindow();
    if (root == null) {
        return;
    }
    if (WechatVersionUtils.canFindViewById(context) && WechatVersionUtils.canRobWechatVersion(context)) {

        List<AccessibilityNodeInfo> exitNodeInfos = root.findAccessibilityNodeInfosByViewId(WechatVersionUtils.getWechatExitId(context));

        if (exitNodeInfos != null && exitNodeInfos.size() > 0) {
            // 是聊天界麵
            if (isWechatAlway) {
            }
        } else {
            isWechatAlway = false;
        }
    }
}
 
開發者ID:duanyikang,項目名稱:QiangYixia,代碼行數:25,代碼來源:HelpService.java

示例3: getAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/***
 * Find a matched node by the method, {@link AccessibilityNodeInfo#findAccessibilityNodeInfosByViewId}.
 * @param accessibilityNodeInfo
 * @param stringResName
 * @return
 */
public static AccessibilityNodeInfo getAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo, String stringResName) {
	AccessibilityNodeInfo foundNodeInfo = null;
	List<AccessibilityNodeInfo> foundNodeInfos;
	if (Utils.hasJellyBeanMR2()) {
		foundNodeInfos = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(stringResName);
		if ((foundNodeInfos != null) && (!foundNodeInfos.isEmpty())) {
			foundNodeInfo = foundNodeInfos.get(0);
		} else {
			LogUtils.LOGD(TAG, "(getAccessibilityNodeInfo) Not found : " + stringResName);
		}
		while (foundNodeInfos.size() > 1) {
			foundNodeInfos.remove(-1 + foundNodeInfos.size()).recycle();
		}
	}
	return foundNodeInfo;
}
 
開發者ID:medalionk,項目名稱:simple-share-android,代碼行數:23,代碼來源:AppDetailsAutomatorUtil.java

示例4: aliFuclickReplayBtn

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private void aliFuclickReplayBtn(AccessibilityEvent event) {
    Log.d(TAG, "aliFuclickReplayBtn() called with: event = [" + event + "]");
    Log.d(TAG, "aliFuclickReplayBtn() called with: event.getClassName() = [" + event.getClassName() + "]");
    if ("android.app.Dialog".equals(event.getClassName())) {

        AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
        List<AccessibilityNodeInfo> sendButtonInfo = nodeInfo.findAccessibilityNodeInfosByViewId("com.alipay.mobile.scan.arplatform:id/lucky_button");
        if (!sendButtonInfo.isEmpty()) {
            Toast.makeText(this, "自動幫你點擊[再來一次]", Toast.LENGTH_SHORT).show();
            sendButtonInfo.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK);
        }
        sendButtonInfo = nodeInfo.findAccessibilityNodeInfosByViewId("com.alipay.android.phone.wallet.roosteryear:id/cr_receive");
        if (!sendButtonInfo.isEmpty()) {
            Toast.makeText(this, "自動幫你點擊[收下福卡]", Toast.LENGTH_SHORT).show();
            sendButtonInfo.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK);
        }
        sendButtonInfo = nodeInfo.findAccessibilityNodeInfosByViewId("com.alipay.mobile.scan.arplatform:id/cover_click_button");
        if (!sendButtonInfo.isEmpty()) {
            Toast.makeText(this, "自動幫你點擊[點擊重試]", Toast.LENGTH_SHORT).show();
            sendButtonInfo.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK);
        }
    }
}
 
開發者ID:mcxtzhang,項目名稱:miser-utils,代碼行數:24,代碼來源:ComeOnMoneyService.java

示例5: openEnvelopeWx

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openEnvelopeWx() {
    AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
    if (nodeInfo == null) {
        Log.w(TAG, "rootWindow為空");
        return;
    }
    List<AccessibilityNodeInfo> list6 = nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/b43");
    Log.w(TAG, "b43list:" + list6);
    for (AccessibilityNodeInfo n : list6) {
        n.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        isAutoOpen = true;
    }
    /**
     * 判斷一下是否已經被搶完了 搶完了就返回
     */
    List<AccessibilityNodeInfo> list7 = nodeInfo.findAccessibilityNodeInfosByText(WX_ACTION_BACK_NO_MONEY);
    if (list7 != null && list7.size() != 0) {
        Log.e(TAG, "[紅包被搶完],手動返回");
        performGlobalAction(GLOBAL_ACTION_HOME);
    }
}
 
開發者ID:mcxtzhang,項目名稱:miser-utils,代碼行數:23,代碼來源:ComeOnMoneyService.java

示例6: autoFetchFrData

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public void autoFetchFrData(AccessibilityEvent event, AccessibilityNodeInfo node,WeixinAutoService context,Map<String,String> record){
    if(node==null){
        LogUtil.d("autoFetchFrData","node 為空;");
        node = context.getRootInActiveWindow();
        return;
    }
    Set<String> set = new HashSet<String>();
    //if(node.getChildCount()>0){
        List<AccessibilityNodeInfo> items = new ArrayList<AccessibilityNodeInfo>();
        List<AccessibilityNodeInfo> items0 = node.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/b66");
        List<AccessibilityNodeInfo> items1 = node.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/mo");
        if(items0==null&&items1==null){ LogUtil.d("autoFetchFrData","列表數據為空");return;}
        items.addAll(items0);
        items.addAll(items1);
        if(items!=null&&items.size()>0){
            for(AccessibilityNodeInfo item:items){
                String text = item.getText().toString();
                set.add(text);
                if(isExist(strs,text)){
                    System.out.println("重複---->"+text);
                }else{
                    LogUtil.d("autoFetchFrData",text);
                }
            }
        }
   // }
    int waitTimes = 4000+(int) (Math.random()*1200);
    AutoUtil.sleep(waitTimes);
    AccessibilityNodeInfo nodeInfo2 = AutoUtil.findNodeInfosById(node,"com.tencent.mm:id/csl");//listView
    if(nodeInfo2!=null){
        nodeInfo2.performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
    }
}
 
開發者ID:brute121105,項目名稱:weixin_auto,代碼行數:34,代碼來源:WxFetchFrDataService.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: fineNodeByIdAndText

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public static AccessibilityNodeInfo fineNodeByIdAndText(AccessibilityNodeInfo nodeInfo,String id,String text){
    AccessibilityNodeInfo result = null;
    if(nodeInfo==null) return result;
    List<AccessibilityNodeInfo> nodes = nodeInfo.findAccessibilityNodeInfosByViewId(id);
    if(nodes == null || nodes.isEmpty()) return result;
    for(AccessibilityNodeInfo node:nodes){
        String name = node.getText()+"";
        if(name.equals(text)){
            result = node;
            break;
        }
    }
    return result;
}
 
開發者ID:brute121105,項目名稱:weixin_auto,代碼行數:15,代碼來源:AutoUtil.java

示例9: WeChatUIRobRedMoney

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private void WeChatUIRobRedMoney(AccessibilityNodeInfo nodeInfo) {
    if (isSelfSendMoney) {
        // 自己發的,回複一下數據
        detailGetMoneyOk = false;
        detailGetNameOk = false;
    }



    if (!isNotDO) {
        S(" 準備點擊紅包--");
        // 紅包
        List<AccessibilityNodeInfo> redMoneyItems = nodeInfo.findAccessibilityNodeInfosByViewId(WechatVersionUtils.getWechatGetRedMoneyId(context));
        S("  redMoneyItems:" + redMoneyItems);
        if (redMoneyItems != null && redMoneyItems.size() > 0) {
            AccessibilityNodeInfo nodeInfo1 = redMoneyItems.get(redMoneyItems.size() - 1);
            S(" 要開始點擊紅包了:" + nodeInfo1.getText().toString());
            if (nodeInfo1.getText().toString().equals("查看紅包")||nodeInfo1.getText().toString().equals("領取紅包")) {
                // TODO 是否搶自己的紅包
                boolean isRobSelf = true;
                if (!isRobSelf) {
                    return;
                }
                isSelfSendMoney = true;
            } else {
                isSelfSendMoney = false;
            }
            // TODO 隨機延時 固定延時
            delayRob(nodeInfo1.getParent());
        }
    }
    isNotDO = false;
}
 
開發者ID:duanyikang,項目名稱:QiangYixia,代碼行數:34,代碼來源:HelpService.java

示例10: click

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private void click(String clickId) {
    AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
    if (nodeInfo != null) {
        List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByViewId(clickId);
        for (AccessibilityNodeInfo item : list) {
            item.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        }
    }
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:11,代碼來源:Air.java

示例11: findNodeById

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
 * 根據id查找結點,存在返回不存在返回null
 *
 * @param nodeInfo
 * @param viewId
 * @return
 */
public static AccessibilityNodeInfo findNodeById(AccessibilityNodeInfo nodeInfo, String viewId) {
    if (nodeInfo == null || viewId == null) {
        return null;
    }
    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByViewId(viewId);
    if (list != null && list.size() > 0) {
        return list.get(0);
    }
    return null;
}
 
開發者ID:pengwei1024,項目名稱:adb-install-robot,代碼行數:18,代碼來源:AccessibilityNodeUtil.java

示例12: findEditTextSend

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private boolean findEditTextSend(AccessibilityNodeInfo rootNode,String content) {
    List<AccessibilityNodeInfo> editInfo = rootNode.findAccessibilityNodeInfosByViewId(Contant.chatUI_EditText_id);
    if(editInfo!=null&&!editInfo.isEmpty()){
        Bundle arguments = new Bundle();
        arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, content);
        editInfo.get(0).performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
        return true;
    }
    return false;
}
 
開發者ID:xmlxin,項目名稱:ReplyMessage,代碼行數:11,代碼來源:AutoReplyService.java

示例13: 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

示例14: autoLogin

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public void autoLogin(AccessibilityEvent event, AccessibilityNodeInfo nodeInfo, WeixinAutoService context, Map<String,String> record){
    List<String[]> accounts = this.getAccount();
    int eventType = event.getEventType();
    if(nodeInfo==null){
        LogUtil.d("autoFetchFrData","node 為空;");
        return;
    }
    //1、退出當前賬號
    if(AutoUtil.checkAction(record,Constants.LOGIN_ACTION_08)||AutoUtil.checkAction(record,Constants.CHAT_LISTENING)){
        AccessibilityNodeInfo exitCurrentAcountBtn = AutoUtil.findNodeInfosByText(nodeInfo,"退出當前帳號");
        AutoUtil.performClick(exitCurrentAcountBtn,record,Constants.LOGIN_ACTION_01,500);
        return;
    }
    //2、確認退出
    if(AutoUtil.checkAction(record,Constants.LOGIN_ACTION_01)){
        AccessibilityNodeInfo quiteConfirmBtn = nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/bu8").get(0).getChild(1);
        //AccessibilityNodeInfo quiteConfirmBtn = AutoUtil.findNodeInfosById(nodeInfo,"com.tencent.mm:id/bu8");
        AutoUtil.performClick(quiteConfirmBtn,record,Constants.LOGIN_ACTION_02);
        return;
    }
    //3、更多
    if(AutoUtil.checkAction(record,Constants.LOGIN_ACTION_02)){
        AccessibilityNodeInfo moreBtn = AutoUtil.findNodeInfosByText(nodeInfo,"更多");
        AutoUtil.performClick(moreBtn,record,Constants.LOGIN_ACTION_03,500);
        return;
    }
    //4、切換賬號
    if(AutoUtil.checkAction(record,Constants.LOGIN_ACTION_03)){
        List<AccessibilityNodeInfo> changeAccount =  nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/amv");
        if(changeAccount!=null&&changeAccount.size()>0){
            AutoUtil.performClick(changeAccount.get(0).getChild(0),record,Constants.LOGIN_ACTION_04);
        }
        return;
    }
    //5、使用其他方式登錄
    if(AutoUtil.checkAction(record,Constants.LOGIN_ACTION_04)){
        AccessibilityNodeInfo changeLoginWayBtn = AutoUtil.findNodeInfosByText(nodeInfo,"使用其他方式登錄");
        AutoUtil.performClick(changeLoginWayBtn,record,Constants.LOGIN_ACTION_05,500);
        return;
    }
    //6、輸入賬號、密碼、點擊登錄
    if(AutoUtil.checkAction(record,Constants.LOGIN_ACTION_05)){
        List<AccessibilityNodeInfo> userNode =  nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/bfm");
        if(userNode!=null&&userNode.size()==1){
            String username = accounts.get(accountIndex)[0];
            AutoUtil.performSetText(userNode.get(0).getChild(1),username,record,Constants.LOGIN_ACTION_06);
        }
        List<AccessibilityNodeInfo> pwdNode =  nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/bfn");
        if(pwdNode!=null&&pwdNode.size()==1){
            AutoUtil.performSetText(pwdNode.get(0).getChild(1),accounts.get(accountIndex)[1],record,Constants.LOGIN_ACTION_07);
        }
        AutoUtil.sleep(500);
        AccessibilityNodeInfo loginBtn = AutoUtil.findNodeInfosById(nodeInfo,"com.tencent.mm:id/bfo");
        AutoUtil.performClick(loginBtn,record,Constants.LOGIN_ACTION_08);
        if(accounts.size()-1==accountIndex){
            accountIndex = 0;
        }else {
            accountIndex = accountIndex+1;
        }
        AutoUtil.recordAndLog(record,Constants.CHAT_LISTENING);
    }
}
 
開發者ID:brute121105,項目名稱:weixin_auto,代碼行數:63,代碼來源:WxLoginService.java

示例15: findNodeInfosById

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public static AccessibilityNodeInfo findNodeInfosById(AccessibilityNodeInfo nodeInfo, String id) {
    if(nodeInfo==null) return null;
    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByViewId(id);
    if(list == null || list.isEmpty()) return null;
    return list.get(0);
}
 
開發者ID:brute121105,項目名稱:weixin_auto,代碼行數:7,代碼來源:AutoUtil.java


注:本文中的android.view.accessibility.AccessibilityNodeInfo.findAccessibilityNodeInfosByViewId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。