当前位置: 首页>>代码示例>>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;未经允许,请勿转载。