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


Java AccessibilityNodeInfo.getText方法代码示例

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


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

示例1: iterator

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void iterator(AccessibilityNodeInfo info, AccessibilityService service) {
    if (info.getText() != null) {
        if (info.getText().equals("签到") && info.isClickable()) {
            info.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;
                }
                iterator(info.getChild(i), service);
            }
        }
    }
    return ;
}
 
开发者ID:Sl0v3C,项目名称:Android_AutoSignInTool,代码行数:23,代码来源:autoSignInTXDM.java

示例2: serialize

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static SerializedAccessibilityNodeInfo serialize(AccessibilityNodeInfo node){
    SerializedAccessibilityNodeInfo serializedNode = new SerializedAccessibilityNodeInfo();
    Rect boundsInScreen = new Rect(), boundsInParent = new Rect();
    if(node == null){
        return null;
    }
    if(node.getClassName() != null)
        serializedNode.className = node.getClassName().toString();
    node.getBoundsInScreen(boundsInScreen);
    node.getBoundsInParent(boundsInParent);

    serializedNode.boundsInScreen = boundsInScreen.flattenToString();
    serializedNode.boundsInParent = boundsInParent.flattenToString();

    if(node.getContentDescription() != null)
        serializedNode.contentDescription = node.getContentDescription().toString();

    if(node.getText() != null){
        serializedNode.text = node.getText().toString();
    }

    if(node.getViewIdResourceName() != null)
        serializedNode.viewId = node.getViewIdResourceName();

    int childCount = node.getChildCount();
    for(int i = 0; i < childCount; i ++){
        if(node.getChild(i) != null){
            serializedNode.children.add(serialize(node.getChild(i)));
        }
    }

    return serializedNode;
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:34,代码来源:AccessibilityUtils.java

示例3: isAccessibilityNodeEnable

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static boolean isAccessibilityNodeEnable(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) && node.isEnabled()) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:20,代码来源:BaseAccessibility.java

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

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

示例6: onInitializeAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (VERSION.SDK_INT >= 14) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(ACCESSIBILITY_EVENT_CLASS_NAME);
        CharSequence switchText = isChecked() ? this.mTextOn : this.mTextOff;
        if (!TextUtils.isEmpty(switchText)) {
            CharSequence oldText = info.getText();
            if (TextUtils.isEmpty(oldText)) {
                info.setText(switchText);
                return;
            }
            StringBuilder newText = new StringBuilder();
            newText.append(oldText).append(' ').append(switchText);
            info.setText(newText);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:SwitchCompat.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: 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

示例10: isIncomingMessage

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 *
 * @param nodeInfo
 * @return
 */
public static boolean isIncomingMessage(AccessibilityNodeInfo nodeInfo, Context context) {
    Rect rect = new Rect();
    nodeInfo.getBoundsInScreen(rect);

    return rect.left < UIUtils.getScreenHeight(context)
            - rect.right && nodeInfo.getText() != null;
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:13,代码来源:AccessibilityUtils.java

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

示例12: urlFromAddressFields

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private String urlFromAddressFields(List<AccessibilityNodeInfo> urlFields, String url) {
    if (!urlFields.isEmpty())
    {
        AccessibilityNodeInfo addressField = urlFields.get(0);
        CharSequence text = addressField.getText();
        if (text != null)
        {
            url = text.toString();
            if (!url.contains("://"))
                url = "http://" + url;
        }
    }
    return url;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:15,代码来源:AutoFillService.java

示例13: performClickAction

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/***
   * 
   * @param accessibilityNodeInfo
   * @return
   */
  public static boolean performClickAction(AccessibilityNodeInfo accessibilityNodeInfo) {
  	if (!isVisibleToUser(accessibilityNodeInfo)) {
  		return false;
  	}
  	CharSequence nodeInfoText = accessibilityNodeInfo.getText();
  	if (!accessibilityNodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK)) {
	LogUtils.LOGD(TAG, "(performAction) Failed to click " + nodeInfoText);
  		return false;
  	}

LogUtils.LOGD(TAG, "(performAction) Clicked " + nodeInfoText);
  	return true;
  }
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:19,代码来源:AppDetailsAutomatorUtil.java

示例14: findChildView2

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void findChildView2(AccessibilityNodeInfo info, String parentText) {
        parentText = parentText + " |-- " + info.getText();
        L.d("得到控件 " + parentText);
        for (int i = 0; i < info.getChildCount(); i++) {
            AccessibilityNodeInfo child = info.getChild(i);
            if (child != null) {
//                L.d("得到子控件 " + child.getText());
                findChildView2(child, parentText + "");
            } else {
//                L.d("得到所有控件" + info.getText());
            }
        }
    }
 
开发者ID:kaixuanluo,项目名称:pc-android-controller-android,代码行数:14,代码来源:AccessUtil.java

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


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