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


Java AccessibilityNodeInfo.getBoundsInScreen方法代码示例

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


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

示例1: 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:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:25,代码来源:AccessibilityNodeInfoHelper.java

示例2: nodeInfoToViewItem

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private synchronized static ViewItem nodeInfoToViewItem(AccessibilityNodeInfo node, int depth) {
    ViewItem vi = new ViewItem();
    Rect rect = new Rect();
    node.getBoundsInScreen(rect);
    vi.bounds = new Point(rect.left, rect.top);
    vi.wh = new Point(rect.width(), rect.height());

    vi.id = id++;
    vi.level = depth;
    ViewItem v = getLastTopLevelNode(itemList, depth - 1);
    vi.parentId = (v == null ? NO_PARENT : v.id);
    vi.simpleClassName = node.getClassName().toString();
    if (vi.simpleClassName.contains(".")) {
        vi.simpleClassName = vi.simpleClassName.substring(vi.simpleClassName.lastIndexOf("."));
    }
    return vi;
}
 
开发者ID:w568w,项目名称:fuckView,代码行数:19,代码来源:ViewDumper.java

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

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

示例5: generateSignature

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public boolean generateSignature(AccessibilityNodeInfo node, String excludeWords) {
    try {
        /* The hongbao container node. It should be a LinearLayout. By specifying that, we can avoid text messages. */
        AccessibilityNodeInfo hongbaoNode = node.getParent();
        if (!"android.widget.LinearLayout".equals(hongbaoNode.getClassName())) return false;

        /* The text in the hongbao. Should mean something. */
        String hongbaoContent = hongbaoNode.getChild(0).getText().toString();
        if (hongbaoContent == null || "查看红包".equals(hongbaoContent)) return false;

        /* Check the user's exclude words list. */
        String[] excludeWordsArray = excludeWords.split(" +");
        for (String word : excludeWordsArray) {
            if (word.length() > 0 && hongbaoContent.contains(word)) return false;
        }

        /* The container node for a piece of message. It should be inside the screen.
            Or sometimes it will get opened twice while scrolling. */
        AccessibilityNodeInfo messageNode = hongbaoNode.getParent();

        Rect bounds = new Rect();
        messageNode.getBoundsInScreen(bounds);
        if (bounds.top < 0) return false;

        /* The sender and possible timestamp. Should mean something too. */
        String[] hongbaoInfo = getSenderContentDescriptionFromNode(messageNode);
        if (this.getSignature(hongbaoInfo[0], hongbaoContent, hongbaoInfo[1]).equals(this.toString())) return false;

        /* So far we make sure it's a valid new coming hongbao. */
        this.sender = hongbaoInfo[0];
        this.time = hongbaoInfo[1];
        this.content = hongbaoContent;
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
 
开发者ID:KoreHuang,项目名称:WeChatLuckyMoney,代码行数:39,代码来源:HongbaoSignature.java

示例6: getBoundsInScreen

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static Rect getBoundsInScreen(AccessibilityNodeInfo nodeInfo) {
    Rect rect = new Rect();
    nodeInfo.getBoundsInScreen(rect);
    return rect;
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:6,代码来源:AccessibilityNodeInfoHelper.java

示例7: getBounds

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private Rect getBounds(AccessibilityNodeInfo node) {
    Rect rect = new Rect();
    node.getBoundsInScreen(rect);
    return rect;
}
 
开发者ID:macacajs,项目名称:UIAutomatorWD,代码行数:6,代码来源:UiAutomationElement.java


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