當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。