本文整理汇总了Java中android.view.accessibility.AccessibilityNodeInfo.performAction方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfo.performAction方法的具体用法?Java AccessibilityNodeInfo.performAction怎么用?Java AccessibilityNodeInfo.performAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityNodeInfo
的用法示例。
在下文中一共展示了AccessibilityNodeInfo.performAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMsg
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public void sendMsg(AccessibilityNodeInfo node,WeixinAutoService context,Map<String,String> record){
AccessibilityNodeInfo editText = AutoUtil.findNodeInfosById(context.getRootInActiveWindow(),"com.tencent.mm:id/a3b");
//6、填充第3步已获取消息到输入框
if(editText!=null){
editText.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT,AutoUtil.createBuddleText(System.currentTimeMillis()+""));
AutoUtil.recordAndLog(record,Constants.CHAT_ACTION_05);
}
//7、发送
if(Constants.CHAT_ACTION_05.equals(record.get("recordAction"))){
AccessibilityNodeInfo sendBtn = AutoUtil.findNodeInfosByText(context.getRootInActiveWindow(),"发送");
AutoUtil.performClick(sendBtn,record,Constants.CHAT_ACTION_06,3000);
}
AccessibilityNodeInfo backBtn = AutoUtil.findNodeInfosById(context.getRootInActiveWindow(),"com.tencent.mm:id/gg");
AutoUtil.performClick(backBtn,record,"backBtnbackBtn",3000);
LogUtil.d("chat","69");
}
示例2: sendComment
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void sendComment() {
try {
AccessibilityNodeInfo outNode =
getRootInActiveWindow().getChild(0).getChild(0);
AccessibilityNodeInfo nodeToInput = outNode.getChild(outNode.getChildCount() - 1).getChild(0).getChild(1);
if ("android.widget.EditText".equals(nodeToInput.getClassName())) {
Bundle arguments = new Bundle();
arguments.putCharSequence(AccessibilityNodeInfo
.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, signature.commentString);
nodeToInput.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
}
} catch (Exception e) {
// Not supported
}
}
示例3: watchList
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private boolean watchList(AccessibilityEvent event) {
if (mListMutex) return false;
mListMutex = true;
AccessibilityNodeInfo eventSource = event.getSource();
// Not a message
if (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED || eventSource == null)
return false;
List<AccessibilityNodeInfo> nodes = eventSource.findAccessibilityNodeInfosByText(WECHAT_NOTIFICATION_TIP);
//增加条件判断currentActivityName.contains(WECHAT_LUCKMONEY_GENERAL_ACTIVITY)
//避免当订阅号中出现标题为“[微信红包]拜年红包”(其实并非红包)的信息时误判
if (!nodes.isEmpty() && currentActivityName.contains(WECHAT_LUCKMONEY_GENERAL_ACTIVITY)) {
AccessibilityNodeInfo nodeToClick = nodes.get(0);
if (nodeToClick == null) return false;
CharSequence contentDescription = nodeToClick.getContentDescription();
if (contentDescription != null && !signature.getContentDescription().equals(contentDescription)) {
nodeToClick.performAction(AccessibilityNodeInfo.ACTION_CLICK);
signature.setContentDescription(contentDescription.toString());
return true;
}
}
return false;
}
示例4: clickAction
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void clickAction(List<AccessibilityNodeInfo> infolist){
for(AccessibilityNodeInfo node :infolist){
String text=node.getText().toString();
AccessibilityNodeInfo info=getClickableNode(node);
if(info==null) continue;
info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
if(text.equals(QQ_KEYWORD_HONGBAO[1])){
onClick();
}else{
isNeedBack=true;
}
}
runState=false;
Log.i(TAG,"总共耗时:"+(System.currentTimeMillis()-time)+"ms");
}
示例5: 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(); // 即搜索结果数目
}
示例6: 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);
}
}
}
示例7: checkKey1
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void checkKey1()
{
AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
if (nodeInfo == null)
return;
List<AccessibilityNodeInfo> list = nodeInfo.findAccessibilityNodeInfosByText("拆红包");
if (list == null || list.size() == 0)
{
list = nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/b2c");
}
for (AccessibilityNodeInfo n : list)
{
n.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
}
示例8: 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;
}
}
}
示例9: performClick
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
* 点击事件
*/
public static void performClick(AccessibilityNodeInfo nodeInfo) {
if (nodeInfo == null) {
return;
}
if (nodeInfo.isClickable()) {
nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
} else {
performClick(nodeInfo.getParent());
}
}
示例10: 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 ;
}
示例11: handleAppDetail
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void handleAppDetail(AccessibilityNodeInfo source) {
AccessibilityNodeInfo forceStopNodeInfo = null;
forceStopNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, FORCE_STOP_STRING_RES_NAME);
if (forceStopNodeInfo == null) {
if (Utils.hasLollipop()) {
forceStopNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, FORCE_STOP_STRING_RIGHT_BOTTON);
} else {
forceStopNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, FORCE_STOP_STRING_LEFT_BOTTON);
}
}
if (forceStopNodeInfo == null) {
forceStopNodeInfo = AppDetailsAutomatorUtil.findAccessibilityNodeInfo(source, mForceStop);
}
if (forceStopNodeInfo == null) {
forceStopNodeInfo = AppDetailsAutomatorUtil.findAccessibilityNodeInfo(source, mFinishApplication);
}
boolean performClick = false;
if (forceStopNodeInfo != null) {
AppDetailsAutomatorUtil.checkVisibleToUserTimeOut(forceStopNodeInfo);
if (AppDetailsAutomatorUtil.isVisibleToUser(forceStopNodeInfo)) {
AppDetailsAutomatorUtil.performClickAction(forceStopNodeInfo);
performClick = true;
}
forceStopNodeInfo.recycle();
}
if (!performClick) {
if (mPackageNames.isEmpty()) {
source.performAction(AccessibilityService.GLOBAL_ACTION_BACK);
}
mHandler.sendEmptyMessage(MSG_PERFORM_STOP);
}
}
示例12: performClick
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static void performClick(AccessibilityNodeInfo nodeInfo,Map<String,String> record, String recordAction, long ms) {
if(nodeInfo == null) return;
if(nodeInfo.isClickable()) {
nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
recordAndLog(record,recordAction);
//record.put("recordAction",recordAction);
//System.out.println("------>"+record);
sleep(ms);
} else {
performClick(nodeInfo.getParent(),record,recordAction,ms);
}
}
示例13: performClick
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
* 模拟点击(如果该节点不可点击,事件分发原理,尝试递归其所有parent节点)
* @param nodeInfo
*/
public static void performClick(AccessibilityNodeInfo nodeInfo){
if(nodeInfo == null) {
return;
}
if(nodeInfo.isClickable()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
} else {
performClick(nodeInfo.getParent());
}
}
示例14: doClick
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
* 執行點擊
*
* @param infos
*/
private void doClick(List<AccessibilityNodeInfo> infos) {
if (infos != null)
for (AccessibilityNodeInfo info : infos) {
if (info.isEnabled() && info.isClickable()) {
Log.i(TAG, "> doClick: " + info.getText());
info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
}
}
示例15: 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;
}