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


Java AccessibilityNodeInfo類代碼示例

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


AccessibilityNodeInfo類屬於android.view.accessibility包,在下文中一共展示了AccessibilityNodeInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onAccessibilityEvent

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    switch (eventType) {
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
            for (String id : installBtnId) {
                AccessibilityNodeInfo node = AccessibilityNodeUtil.findNodeById(event.getSource(), id);
                if (node != null) {
                    AccessibilityNodeUtil.click(node);
                    Toast.makeText(this, "安裝成功", Toast.LENGTH_SHORT).show();
                    break;
                }
            }
            break;
        default:
            break;
    }
}
 
開發者ID:pengwei1024,項目名稱:adb-install-robot,代碼行數:21,代碼來源:AutoInstallAccessibilityService.java

示例2: findViewIdAndClick

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
/**
 * 檢查viewId進行點擊
 *
 * @param accessibilityService
 * @param id
 */
public static void findViewIdAndClick(AccessibilityService accessibilityService, String id) {

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

    List<AccessibilityNodeInfo> nodeInfoList = accessibilityNodeInfo.findAccessibilityNodeInfosByViewId(id);
    if (nodeInfoList != null && !nodeInfoList.isEmpty()) {
        for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
            if (nodeInfo != null) {
                performClick(nodeInfo);
                break;
            }
        }
    }
}
 
開發者ID:xmlxin,項目名稱:ReplyMessage,代碼行數:24,代碼來源:PerformClickUtils.java

示例3: isMemberChatUi

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
/** 是否為群聊天 */
private boolean isMemberChatUi(AccessibilityNodeInfo nodeInfo) {
    if(nodeInfo == null) {
        return false;
    }

    AccessibilityNodeInfo label = AccessibilityUtils.findNodeInfosById(nodeInfo, ID_GROUP_NAME);
    if(label != null) {
        String title = String.valueOf(label.getText());
        LogUtils.printOut("title", title);
        if(title != null && title.endsWith(")")) {
            return true;
        }
    }
    return false;
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:17,代碼來源:WeChatAccessibilityJob.java

示例4: findAccessibilityNodeInfosByText

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
@Override
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String searched,
                                                                    int virtualViewId) {
    if (TextUtils.isEmpty(searched)) {
        return Collections.emptyList();
    }
    String searchedLowerCase = searched.toLowerCase();
    List<AccessibilityNodeInfo> result = new ArrayList<AccessibilityNodeInfo>();
    switch (virtualViewId) {
        case View.NO_ID: {
            findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
                    VIRTUAL_VIEW_ID_DECREMENT, result);
            findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
                    VIRTUAL_VIEW_ID_INPUT, result);
            findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
                    VIRTUAL_VIEW_ID_INCREMENT, result);
            return result;
        }
        case VIRTUAL_VIEW_ID_DECREMENT:
        case VIRTUAL_VIEW_ID_INCREMENT:
        case VIRTUAL_VIEW_ID_INPUT: {
            findAccessibilityNodeInfosByTextInChild(searchedLowerCase, virtualViewId,
                    result);
            return result;
        }
    }
    return super.findAccessibilityNodeInfosByText(searched, virtualViewId);
}
 
開發者ID:Gericop,項目名稱:DateTimePicker,代碼行數:29,代碼來源:NumberPicker.java

示例5: FillPassword

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
@TargetApi(21)
private void FillPassword(String url, AccessibilityNodeInfo usernameEdit, List<AccessibilityNodeInfo> passwordFields)
{
    if ((keepass2android.kbbridge.KeyboardData.hasData()) && (_hasUsedData == false))
    {
        fillDataInTextField(usernameEdit, getLastReceivedCredentialsUser());
        for (int i=0;i<passwordFields.size();i++)
        {
            fillDataInTextField(passwordFields.get(i), getLastReceivedCredentialsPassword());
        }
        _hasUsedData = true;
    }



    //LookupCredentialsActivity.LastReceivedCredentials = null;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:18,代碼來源:AutoFillService.java

示例6: createActionWithEditableFilter

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static SimpleAction createActionWithEditableFilter(final int action, int index, final String text) {
    return new SearchTargetAction(action, new FilterAction.EditableFilter(index)) {

        @Override
        protected void performAction(UiObject node) {
            Bundle args = new Bundle();
            if (action == AccessibilityNodeInfo.ACTION_SET_TEXT) {
                args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
            } else {
                args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, node.text() + text);
            }
            node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args);
        }
    };
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:17,代碼來源:ActionFactory.java

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

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

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

示例10: onInitializeAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
@TargetApi(21)
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(com.google.android.exoplayer2.ui.DefaultTimeBar.class.getCanonicalName());
    info.setContentDescription(getProgressText());
    if (duration <= 0) {
        return;
    }
    if (Util.SDK_INT >= 21) {
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
    } else if (Util.SDK_INT >= 16) {
        info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    }
}
 
開發者ID:hongcwamazing,項目名稱:PreviewSeekBar-master,代碼行數:18,代碼來源:CustomTimeBar.java

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

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

示例12: performAccessibilityAction

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
@Override
public boolean performAccessibilityAction(View host, int action, Bundle arguments) {
    if (super.performAccessibilityAction(host, action, arguments)) {
        return true;
    }

    switch (action) {
        case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:
            adjustPicker(1);
            return true;
        case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:
            adjustPicker(-1);
            return true;
    }

    return false;
}
 
開發者ID:Gericop,項目名稱:DateTimePicker,代碼行數:18,代碼來源:RadialTimePickerView.java

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

示例14: getVisibleBoundsInScreen

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
/**
 * Returns the node's bounds clipped to the size of the display
 *
 * @param node
 * @param width  pixel width of the display
 * @param height pixel height of the display
 * @return null if node is null, else a Rect containing visible bounds
 */
public static Rect getVisibleBoundsInScreen(AccessibilityNodeInfo node, int width, int height) {
    if (node == null) {
        return null;
    }
    // targeted node's bounds
    Rect nodeRect = new Rect();
    node.getBoundsInScreen(nodeRect);

    Rect displayRect = new Rect();
    displayRect.top = 0;
    displayRect.left = 0;
    displayRect.right = width;
    displayRect.bottom = height;
    boolean intersect = nodeRect.intersect(displayRect);
    return nodeRect;
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:25,代碼來源:AccessibilityNodeInfoHelper.java

示例15: clickRedPacketAfter

import android.view.accessibility.AccessibilityNodeInfo; //導入依賴的package包/類
/** 查看領取詳情或者返回 */
private void clickRedPacketAfter() {
    // 到這, 領取流程算是完了
    isReceived = false;

    // 查看領取詳情, 或者返回
    if(!config().isSmartBackQQ()){
        SystemClock.sleep(999);
        AccessibilityNodeInfo nodeInfo = mService.getRootInActiveWindow();
        if(nodeInfo == null) {
            LogUtils.printErr(TAG, "rootWindow為空");
            return;
        }

        AccessibilityNodeInfo look = AccessibilityUtils.findNodeInfosByText(nodeInfo, KEY_LOOK);
        if(look != null){
            AccessibilityUtils.performClick(look);
        }
    }else{
        back();
    }
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:23,代碼來源:QQAccessibilityJob.java


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