@Override public Bounds getBounds() { Point upperLeft = new Point(bounds.left, bounds.top); // As Bounds are initially constructed with width and height int width = bounds.right - bounds.left; int height = bounds.bottom - bounds.top; return new Bounds(upperLeft, width, height); } }
Point second = new Point(secondPointX, secondPointY); Bounds result = new Bounds(first, second); return result; } else {
/** * Gets the given bounds equivalent relative to the bounds upper left corner; * * @param bounds * - {@link Bounds} for which to get the relative bounds to the bounds upper left corner * @return the bounds equivalent relative to the bounds upper left corner */ public Bounds getRelativeBounds(Bounds bounds) { Point boundsUpperLeftCorner = bounds.getUpperLeftCorner(); int boundsWidth = bounds.getWidth(); int boundsHeight = bounds.getHeight(); Point relativeUpperLeftCorner = getRelativePoint(boundsUpperLeftCorner); Bounds relativeBounds = new Bounds(relativeUpperLeftCorner, boundsWidth, boundsHeight); return relativeBounds; }
protected void setCommonProperties(AccessibilityNodeInfo nodeInfo, AccessibilityElement element, int index) { element.setText(CharSequenceUtils.getString(nodeInfo.getText())); element.setClassName(CharSequenceUtils.getString(nodeInfo.getClassName())); element.setPackageName(CharSequenceUtils.getString(nodeInfo.getPackageName())); element.setContentDescriptor(CharSequenceUtils.getString(nodeInfo.getContentDescription())); element.setChechkable(nodeInfo.isCheckable()); element.setChechked(nodeInfo.isChecked()); element.setClickable(nodeInfo.isClickable()); element.setEnabled(nodeInfo.isEnabled()); element.setFocusable(nodeInfo.isFocusable()); element.setFocused(nodeInfo.isFocused()); element.setScrollable(nodeInfo.isScrollable()); element.setLongClickable(nodeInfo.isLongClickable()); element.setPassword(nodeInfo.isPassword()); element.setSelected(nodeInfo.isSelected()); element.setIndex(index); Rect boundsRect = new Rect(); nodeInfo.getBoundsInScreen(boundsRect); Point topLeft = new Point(boundsRect.left, boundsRect.top); Point bottomRight = new Point(boundsRect.right, boundsRect.bottom); Bounds bounds = new Bounds(topLeft, bottomRight); element.setBounds(bounds); }