本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}