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


Java AccessibilityNodeInfo.getParent方法代碼示例

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


在下文中一共展示了AccessibilityNodeInfo.getParent方法的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: findGiftInChat

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private void findGiftInChat() {
    AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
    if (nodeInfo == null) {
        Log.w(TAG, "rootWindow為空");
        return;
    }
    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByText(DINGDING_ACTION_SEE_GIFT);
    if (list != null) {
        for (AccessibilityNodeInfo n : list) {
            //點擊父控件 ListView的Item
            AccessibilityNodeInfo parent = n.getParent();
            Log.i(TAG, "-->聊天界麵尋找釘釘紅包:" + n);
            parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            break;
        }
    }
}
 
開發者ID:mcxtzhang,項目名稱:miser-utils,代碼行數:18,代碼來源:ComeOnMoneyService.java

示例3: enterChatHasGift

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private void enterChatHasGift() {
    AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
    if (nodeInfo == null) {
        Log.w(TAG, "rootWindow為空");
        return;
    }
    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByText(DINGDING_ENVELOPE_TEXT_KEY);
    if (list != null) {
        for (AccessibilityNodeInfo n : list) {
            //點擊父控件 ListView的Item
            AccessibilityNodeInfo parent = n.getParent();
            Log.i(TAG, "-->主界麵尋找釘釘紅包:" + n);
            parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            break;
        }
    }
}
 
開發者ID:mcxtzhang,項目名稱:miser-utils,代碼行數:18,代碼來源:ComeOnMoneyService.java

示例4: getRedSenderInfo

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public static String getRedSenderInfo(AccessibilityNodeInfo node) {
    AccessibilityNodeInfo nodeParent = node.getParent();
    if ("android.widget.ListView".equals(nodeParent)) return null;
    if (!TextUtils.isEmpty(nodeParent.getChild(0).getText()))
        content = nodeParent.getChild(0).getText().toString();//get content
    nodeParent = nodeParent.getParent();
    if (null==nodeParent)return null;
    if (!TextUtils.isEmpty(nodeParent.getChild(0).getText()))
        sendTime = nodeParent.getChild(0).getText().toString();//get Time
    for (int i = 0; i < nodeParent.getChildCount(); i++) {
        AccessibilityNodeInfo nodeChild = nodeParent.getChild(i);
        if ("android.widget.ImageView".equals(nodeChild.getClassName())) {
            CharSequence contentDescription = nodeChild.getContentDescription();
            if (null != contentDescription)
                sender = contentDescription.toString().replaceAll("頭像$", ""); //get sender
        }
    }
    Log.e("LSeven", " red info===>" + sender + " " + content + " " + sendTime);
    return sender+"|"+content+"|"+sendTime;
}
 
開發者ID:WanAndroid,項目名稱:GetRedPackets,代碼行數:21,代碼來源:SelfUtil.java

示例5: getRootAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public static AccessibilityNodeInfo getRootAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo accessibilityNodeInfo) throws MyException {
    if (null == accessibilityNodeInfo) {
        throw new NullPointerException("accessibilityNodeInfo");
    }
    AccessibilityNodeInfo current = null;
    try {
        current = accessibilityNodeInfo;
        while (true) {
            AccessibilityNodeInfo parent = current.getParent();
            if (null == parent) {
                return current;
            }
            current = parent;
        }
    } catch (Exception e) {
        if (null != current) {
            current.recycle();
        }
        throw new MyException(e);
    }
}
 
開發者ID:littleRich,項目名稱:AutoInteraction-Library,代碼行數:22,代碼來源:UiTree.java

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

示例7: getClickableNode

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
 * 獲取一個可以點擊的節點
 */
private AccessibilityNodeInfo getClickableNode(AccessibilityNodeInfo node){
	AccessibilityNodeInfo parent=node;
	while(parent!=null){
		if(parent.isClickable()){
			break;
		}
		parent=parent.getParent();
	}
	return parent;
}
 
開發者ID:qq1198,項目名稱:mtoolbox,代碼行數:14,代碼來源:HongBaoService.java

示例8: recycle

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public void recycle(AccessibilityNodeInfo info) {
    try {
        if (info.getChildCount() == 0) {
            if (info.getText() != null) {
                if ("領取紅包".equals(info.getText().toString())) {
                    if (info.isClickable()) {
                        info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                    }
                    AccessibilityNodeInfo parent = info.getParent();
                    while (parent != null) {
                        if (parent.isClickable()) {
                            parents.add(parent);
                            break;
                        }
                        parent = parent.getParent();
                    }
                }
            }
        } else {
            for (int i = 0; i < info.getChildCount(); i++) {
                if (info.getChild(i) != null) {
                    recycle(info.getChild(i));
                }
            }
        }
    } catch (Exception e) {


    }
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:31,代碼來源:Air.java

示例9: findNodeAllParents

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public static void findNodeAllParents(AccessibilityNodeInfo topNode,List<AccessibilityNodeInfo> list){
    if (topNode.getParent() != null) {
        AccessibilityNodeInfo parent = topNode.getParent();
        list.add(parent);
        findNodeAllParents(parent,list);
    }
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:8,代碼來源:AceHelper.java

示例10: getFromLastNode

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
    * 搜索包含紅包的UI節點, 點擊末幾個
    *
    * @param root      根UI節點
    * @param size      點擊最後size個
    * @param ignoreDup 是否無視重複檢測
    * @return 成功點擊的紅包數
    */
   Integer getFromLastNode(AccessibilityNodeInfo root, Integer size, boolean ignoreDup)
   {
List<AccessibilityNodeInfo> mNodes =
    root.findAccessibilityNodeInfosByText(getResources().getString(R.string.chat_pattern));

size = Math.min(size, mNodes.size()); // 先設成功點擊數為預計點擊的紅包數目
for (Integer i = mNodes.size() - size; i < mNodes.size(); i++)
{
    AccessibilityNodeInfo node = mNodes.get(i);
    //  Log.d("node", node.toString());
    AccessibilityNodeInfo parent = node.getParent();
    if (parent == null)
    {
	//Log.d("node.parent", "null"); // 有時候沒有父節點, 蜜汁bug
    }
    else
    {
	if (ignoreDup || (lastNode != node.hashCode()))
	{ // 非重複紅包, 點擊
	    //    Log.d("click", "GET" + Integer.valueOf(node.hashCode()).toString());
	    parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
	    cnt_get += 1;
	    lastNode = node.hashCode();
	}
	else
	{
	    //   Log.d("node duplicate", Integer.valueOf(node.hashCode()).toString());
	    size -= 1; // 重複紅包, 減少成功計數
	}
    }
}

return size;
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:43,代碼來源:AnimatedEditText.java

示例11: getRoot

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
AccessibilityNodeInfo getRoot(AccessibilityNodeInfo node)
   {
AccessibilityNodeInfo parent;
parent = node.getParent();
while (parent != null)
{
    node = parent;
    parent = node.getParent();
}
return node;
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:12,代碼來源:AnimatedEditText.java

示例12: getClickableNode

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
    * 獲取一個可以點擊的節點
    */
   private AccessibilityNodeInfo getClickableNode(AccessibilityNodeInfo node)
   {
AccessibilityNodeInfo parent=node;
while (parent != null)
{
    if (parent.isClickable())
    {
	break;
    }
    parent = parent.getParent();
}
return parent;
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:17,代碼來源:dex_smali.java

示例13: generateSignature

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
public boolean generateSignature(AccessibilityNodeInfo node, String excludeWords) {
    try {
        /* The hongbao container node. It should be a LinearLayout. By specifying that, we can avoid text messages. */
        AccessibilityNodeInfo hongbaoNode = node.getParent();
        if (!"android.widget.LinearLayout".equals(hongbaoNode.getClassName())) return false;

        /* The text in the hongbao. Should mean something. */
        String hongbaoContent = hongbaoNode.getChild(0).getText().toString();
        if (hongbaoContent == null || "查看紅包".equals(hongbaoContent)) return false;

        /* Check the user's exclude words list. */
        String[] excludeWordsArray = excludeWords.split(" +");
        for (String word : excludeWordsArray) {
            if (word.length() > 0 && hongbaoContent.contains(word)) return false;
        }

        /* The container node for a piece of message. It should be inside the screen.
            Or sometimes it will get opened twice while scrolling. */
        AccessibilityNodeInfo messageNode = hongbaoNode.getParent();

        Rect bounds = new Rect();
        messageNode.getBoundsInScreen(bounds);
        if (bounds.top < 0) return false;

        /* The sender and possible timestamp. Should mean something too. */
        String[] hongbaoInfo = getSenderContentDescriptionFromNode(messageNode);
        if (this.getSignature(hongbaoInfo[0], hongbaoContent, hongbaoInfo[1]).equals(this.toString())) return false;

        /* So far we make sure it's a valid new coming hongbao. */
        this.sender = hongbaoInfo[0];
        this.time = hongbaoInfo[1];
        this.content = hongbaoContent;
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:KoreHuang,項目名稱:WeChatLuckyMoney,代碼行數:39,代碼來源:HongbaoSignature.java

示例14: parseNodeInfoAndOpenGetPacketDialog

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private void parseNodeInfoAndOpenGetPacketDialog(AccessibilityNodeInfo accessibilityNodeInfo){
    if(accessibilityNodeInfo != null && accessibilityNodeInfo.getChildCount() >0){
        for(int i = 0;i<accessibilityNodeInfo.getChildCount();i++){
            AccessibilityNodeInfo child = accessibilityNodeInfo.getChild(i);
            parseNodeInfoAndOpenGetPacketDialog(child);
        }
    }else{
        if(accessibilityNodeInfo != null && !TextUtils.isEmpty(accessibilityNodeInfo.getText())&&accessibilityNodeInfo.getText().toString().contains("領取紅包")){
            Log.i(TAG,"領取紅包");
            if(accessibilityNodeInfo.isClickable()){
                accessibilityNodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
            }else{
                AccessibilityNodeInfo parent  = accessibilityNodeInfo.getParent();
                while(parent != null ){
                    if(parent.isClickable()){
                        parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                        break;
                    }

                    parent = parent.getParent();
                    Log.i(TAG," 找到一個可以點擊的節點");
                }



            }

        }
    }

}
 
開發者ID:WanAndroid,項目名稱:GetRedPackets,代碼行數:32,代碼來源:GetRedPacketService.java

示例15: onAccessibilityEvent

import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    CharSequence packageName = event.getPackageName();
    switch (eventType) {
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
            AccessibilityNodeInfo rootNode = getRootInActiveWindow();
            if (rootNode != null) {

                if (packageName.equals("com.android.settings")) {
                    AccessibilityNodeInfo settingNode = AceHelper.findNodeByText(rootNode,"WLAN");
                    AceHelper.performClick(settingNode);
                    rootNode.recycle();
                } else if (packageName.equals("com.android.wifisettings")) {
                    AccessibilityNodeInfo wifiNode = AceHelper.findNodeByText(rootNode, "TP-LINK_F770");
                    AccessibilityNodeInfo wifiNodeParent = wifiNode.getParent();
                    AccessibilityNodeInfo iconNode = AceHelper.findNodeById(wifiNodeParent, "com.android.wifisettings:id/advance_layout");
                    AceHelper.performClick(iconNode);
                }
            }
            break;
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
            Toast.makeText(this, "Notify", Toast.LENGTH_SHORT).show();
            event.getSource().recycle();
            break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
            break;
        default:
            break;
    }
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:33,代碼來源:WifiProxyAccessibilityService.java


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