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


Java AccessibilityNodeInfo.findAccessibilityNodeInfosByText方法代码示例

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


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

示例1: hasAccessibilityNode

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static boolean hasAccessibilityNode(AccessibilityNodeInfo info, String[] texts) {
    if (texts != null) {
        for (String textItem : texts) {
            List<AccessibilityNodeInfo> nodes = info.findAccessibilityNodeInfosByText(textItem);
            if (nodes != null && !nodes.isEmpty()) {
                AccessibilityNodeInfo node;
                for (int i = 0; i < nodes.size(); i++) {
                    node = nodes.get(i);
                    BaseAccessibility.logPrint("find text=" + textItem + "  enable=" + node.isEnabled());
                    CharSequence text = node.getText();
                    if (TextUtils.equals(text, textItem)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:20,代码来源:BaseAccessibility.java

示例2: getAllHongBao

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void getAllHongBao(AccessibilityNodeInfo info){
	runState=true;
	Log.i(TAG,"获取所有红包");
	time=System.currentTimeMillis();
	List<AccessibilityNodeInfo> list=new ArrayList<AccessibilityNodeInfo>();
	//查找出当前页面所有的红包,包括手气红包和口令红包
	for(String word:QQ_KEYWORD_HONGBAO){
		List<AccessibilityNodeInfo> infolist  = info.findAccessibilityNodeInfosByText(word);
		if(!infolist.isEmpty()){
			for(AccessibilityNodeInfo node:infolist){
				//这里进行过滤可点击的红包,放到后面去过滤的话感觉非常操蛋
				if(node.getText()==null||
				    //过滤出包含关键字的节点,只取和关键字相同的
				    !node.getText().toString().equals(word)||
					/**
					 * 下面这个条件是过滤已拆开的红包
					 * 如果口令红包的口令设置成"口令红包"
					 * 会让插件陷入死循环,所以必须加个新的判断条件
					 * 不过这样会耗费更多的时间,所以口令尽量不要设置成关键字
					 */
					node.getParent().getChildCount()!=3||
				   !node.getParent().findAccessibilityNodeInfosByText(CAIKAI).isEmpty()||
				   !node.getParent().findAccessibilityNodeInfosByText(CHAKANXIANGQING).isEmpty())
				continue;
				list.add(node);
			}
		}
	}
	if(list.size()==0) {
		runState=false;
		return ;
	}
	Toast.makeText(this,"连续抢到红包数量:"+list.size(),1000).show();
	clickAction(list);
}
 
开发者ID:qq1198,项目名称:mtoolbox,代码行数:36,代码来源:HongBaoService.java

示例3: getFromNode

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
    * 搜索包含红包的UI节点, 点击所有
    *
    * @param root 根UI节点
    * @return 成功点击的红包数
    */
   Integer getFromNode(AccessibilityNodeInfo root)
   {
List<AccessibilityNodeInfo> mNodes =
    root.findAccessibilityNodeInfosByText(getResources().getString(R.string.chat_pattern));

for (AccessibilityNodeInfo node : mNodes)
{
    // Log.d("node", node.toString());
    AccessibilityNodeInfo parent = node.getParent();
    if (parent == null)
    {
	//Log.d("node.parent", "null"); // 有时候没有父节点, 蜜汁bug
    }
    else
    {
	//Log.d("click", "GET" + Integer.valueOf(node.hashCode()).toString());
	parent.performAction(AccessibilityNodeInfo.ACTION_CLICK); // TextView不能点, 点的是ListView, 详情查看clickable
	cnt_get += 1;
	lastNode = node.hashCode();
    }
}

return mNodes.size(); // 即搜索结果数目
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:31,代码来源:AnimatedEditText.java

示例4: containAccessibilityNode

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static boolean containAccessibilityNode(AccessibilityNodeInfo info, String[] texts) {
    if (texts != null) {
        for (String textItem : texts) {
            List<AccessibilityNodeInfo> nodes = info.findAccessibilityNodeInfosByText(textItem);
            if (nodes != null && !nodes.isEmpty()) {
                AccessibilityNodeInfo node;
                for (int i = 0; i < nodes.size(); i++) {
                    node = nodes.get(i);
                    BaseAccessibility.logPrint("find text=" + textItem + "  enable=" + node.isEnabled());
                    CharSequence text = node.getText();
                    if (!TextUtils.isEmpty(text)) {
                        if (text.toString().contains(textItem)) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:22,代码来源:BaseAccessibility.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: 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

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

示例8: openNext2

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void openNext2(String str, AccessibilityNodeInfo nodeInfo, final AccessibilityService service) {
    if (nodeInfo == null) {
        L.d("rootWindow为空");
        return;
    } else {
        L.d("openNext2 " + nodeInfo.getText());
    }
    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByText(str);
    if (list.isEmpty()) {
        return;
    } else {
        CharSequence text = list.get(list.size() - 1).getText();
        if (TextUtils.isEmpty(text)) {
            return;
        } else {
            L.d("openNext2 " + text);
        }
    }

    i++;
    if (isGo) {
        isGo = false;
    }
}
 
开发者ID:kaixuanluo,项目名称:pc-android-controller-android,代码行数:25,代码来源:WeChatNearly.java

示例9: findDialogAndClick

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * 在当前页面查找对话框文字内容并点击
 *
 * @param text1 默认点击text1
 * @param text2
 */
public static void findDialogAndClick(AccessibilityService accessibilityService, String text1, String text2) {

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

    List<AccessibilityNodeInfo> dialogWait = accessibilityNodeInfo.findAccessibilityNodeInfosByText(text1);
    List<AccessibilityNodeInfo> dialogConfirm = accessibilityNodeInfo.findAccessibilityNodeInfosByText(text2);
    if (!dialogWait.isEmpty() && !dialogConfirm.isEmpty()) {
        for (AccessibilityNodeInfo nodeInfo : dialogWait) {
            if (nodeInfo != null && text1.equals(nodeInfo.getText())) {
                performClick(nodeInfo);
                break;
            }
        }
    }

}
 
开发者ID:xmlxin,项目名称:ReplyMessage,代码行数:26,代码来源:PerformClickUtils.java

示例10: findTextAndClick

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * 在当前页面查找文字内容并点击
 *
 * @param text
 */
public static void findTextAndClick(AccessibilityService accessibilityService, String text) {

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

    List<AccessibilityNodeInfo> nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByText(text);
    if (nodeInfoList != null && !nodeInfoList.isEmpty()) {
        for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
            if (nodeInfo != null && (text.equals(nodeInfo.getText()) || text.equals(nodeInfo.getContentDescription()))) {
                performClick(nodeInfo);
                break;
            }
        }
    }
}
 
开发者ID:xmlxin,项目名称:ReplyMessage,代码行数:23,代码来源:PerformClickUtils.java

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

示例12: QQpackge

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void QQpackge(AccessibilityEvent event) {
    if ("com.tencent.mobileqq.activity.VisitorsActivity".equals(event.getClassName().toString())) {
        AccessibilityNodeInfo root = getRootInActiveWindow();
        if (root != null) {
            List<AccessibilityNodeInfo> nodes = root.findAccessibilityNodeInfosByText("赞");
            for (int i = 0; i < nodes.size(); i++) {
                for (int j = 0; j < 10; j++) {
                    nodes.get(i).performAction(AccessibilityNodeInfo.ACTION_CLICK);
                }
            }
        }
    }
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:14,代码来源:SeText.java

示例13: getAllHongBao

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void getAllHongBao(AccessibilityNodeInfo info)
   {
runState = true;
//Log.i(TAG, "获取所有红包");
time = System.currentTimeMillis();
List<AccessibilityNodeInfo> list=new ArrayList<AccessibilityNodeInfo>();
//查找出当前页面所有的红包,包括手气红包和口令红包
for (String word:QQ_KEYWORD_HONGBAO)
{
    List<AccessibilityNodeInfo> infolist  = info.findAccessibilityNodeInfosByText(word);
    if (!infolist.isEmpty())
    {
	for (AccessibilityNodeInfo node:infolist)
	{
	    //这里进行过滤可点击的红包,放到后面去过滤的话感觉非常操蛋
	    if (node.getText() == null ||!node.getText().toString().equals(word) ||node.getParent().getChildCount() != 3 ||!node.getParent().findAccessibilityNodeInfosByText(QQ_KEYWORD_FAILD_CLICK).isEmpty())
		continue;
	    list.add(node);
	}
    }
}
if (list.size() == 0)
{
    runState = false;
    return ;
}
ToastUtil.show(this,list.size()+"/"+(System.currentTimeMillis() - time) + "", Toast.LENGTH_SHORT);
//Log.i(TAG, "数量>>>" + list.size() + "  获取红包耗时:" + (System.currentTimeMillis() - time) + "ms");
clickAction(list);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:31,代码来源:dex_smali.java

示例14: findAndAccessAccessibilityNode

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static boolean findAndAccessAccessibilityNode(AccessibilityNodeInfo info, String[] texts, boolean fuzzy) {
    if (texts != null) {
        for (String textItem : texts) {
            List<AccessibilityNodeInfo> nodes = info.findAccessibilityNodeInfosByText(textItem);
            if (nodes != null && !nodes.isEmpty()) {
                AccessibilityNodeInfo node;
                for (int i = 0; i < nodes.size(); i++) {
                    node = nodes.get(i);
                    BaseAccessibility.logPrint("find text=" + textItem + "  enable=" + node.isEnabled());
                    CharSequence text = node.getText();

                    if (!TextUtils.isEmpty(text)) {
                        if (textItem.equals(text.toString()) || (fuzzy && text.toString().contains(textItem))) {
                            if (node.isEnabled() && node.isClickable()) {
                                if (node.getClassName().equals("android.widget.Button")
                                        || node.getClassName().equals("android.widget.TextView")
                                        || node.getClassName().equals("android.widget.CheckBox")) {
                                    autoClickNumber++;
                                    return node.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:30,代码来源:BaseAccessibility.java

示例15: findNodeByText

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * 通过文本查找节点(注: text是包含contains,而不是完全equals)
 * @param nodeInfo
 * @param text
 * @return
 */
public static AccessibilityNodeInfo findNodeByText(AccessibilityNodeInfo nodeInfo, String text) {
    List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByText(text);
    if(list == null || list.isEmpty()) {
        return null;
    }
    return list.get(0);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:14,代码来源:AceHelper.java


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