Search in sources :

Example 61 with AccessibilityNodeInfo

use of android.view.accessibility.AccessibilityNodeInfo in project android_frameworks_base by DirtyUnicorns.

the class UiObject method isEnabled.

/**
     * Checks if the UI element's <code>enabled</code> property is currently true.
     *
     * @return true if it is else false
     * @throws UiObjectNotFoundException
     * @since API Level 16
     */
public boolean isEnabled() throws UiObjectNotFoundException {
    Tracer.trace();
    AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
    if (node == null) {
        throw new UiObjectNotFoundException(getSelector().toString());
    }
    return node.isEnabled();
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)

Example 62 with AccessibilityNodeInfo

use of android.view.accessibility.AccessibilityNodeInfo in project android_frameworks_base by DirtyUnicorns.

the class UiObject method pinchIn.

/**
     * Performs a two-pointer gesture, where each pointer moves diagonally
     * toward the other, from the edges to the center of this UiObject .
     * @param percent percentage of the object's diagonal length for the pinch gesture
     * @param steps the number of steps for the gesture. Steps are injected 
     * about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete.
     * @return <code>true</code> if all touch events for this gesture are injected successfully,
     *         <code>false</code> otherwise
     * @throws UiObjectNotFoundException
     * @since API Level 18
     */
public boolean pinchIn(int percent, int steps) throws UiObjectNotFoundException {
    // make value between 1 and 100
    percent = (percent < 0) ? 0 : (percent > 100) ? 100 : percent;
    float percentage = percent / 100f;
    AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
    if (node == null) {
        throw new UiObjectNotFoundException(getSelector().toString());
    }
    Rect rect = getVisibleBounds(node);
    if (rect.width() <= FINGER_TOUCH_HALF_WIDTH * 2)
        throw new IllegalStateException("Object width is too small for operation");
    Point startPoint1 = new Point(rect.centerX() - (int) ((rect.width() / 2) * percentage), rect.centerY());
    Point startPoint2 = new Point(rect.centerX() + (int) ((rect.width() / 2) * percentage), rect.centerY());
    Point endPoint1 = new Point(rect.centerX() - FINGER_TOUCH_HALF_WIDTH, rect.centerY());
    Point endPoint2 = new Point(rect.centerX() + FINGER_TOUCH_HALF_WIDTH, rect.centerY());
    return performTwoPointerGesture(startPoint1, startPoint2, endPoint1, endPoint2, steps);
}
Also used : Rect(android.graphics.Rect) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) Point(android.graphics.Point)

Example 63 with AccessibilityNodeInfo

use of android.view.accessibility.AccessibilityNodeInfo in project android_frameworks_base by DirtyUnicorns.

the class UiObject method isClickable.

/**
     * Checks if the UI element's <code>clickable</code> property is currently true.
     *
     * @return true if it is else false
     * @throws UiObjectNotFoundException
     * @since API Level 16
     */
public boolean isClickable() throws UiObjectNotFoundException {
    Tracer.trace();
    AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
    if (node == null) {
        throw new UiObjectNotFoundException(getSelector().toString());
    }
    return node.isClickable();
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)

Example 64 with AccessibilityNodeInfo

use of android.view.accessibility.AccessibilityNodeInfo in project android_frameworks_base by DirtyUnicorns.

the class UiObject method isFocusable.

/**
     * Check if the UI element's <code>focusable</code> property is currently true.
     *
     * @return true if it is else false
     * @throws UiObjectNotFoundException
     * @since API Level 16
     */
public boolean isFocusable() throws UiObjectNotFoundException {
    Tracer.trace();
    AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
    if (node == null) {
        throw new UiObjectNotFoundException(getSelector().toString());
    }
    return node.isFocusable();
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)

Example 65 with AccessibilityNodeInfo

use of android.view.accessibility.AccessibilityNodeInfo in project android_frameworks_base by DirtyUnicorns.

the class UiObject method getChildCount.

/**
     * Counts the child views immediately under the present UiObject.
     *
     * @return the count of child views.
     * @throws UiObjectNotFoundException
     * @since API Level 16
     */
public int getChildCount() throws UiObjectNotFoundException {
    Tracer.trace();
    AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
    if (node == null) {
        throw new UiObjectNotFoundException(getSelector().toString());
    }
    return node.getChildCount();
}
Also used : AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)

Aggregations

AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)310 Point (android.graphics.Point)84 Rect (android.graphics.Rect)84 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)45 RemoteException (android.os.RemoteException)30 IAccessibilityInteractionConnectionCallback (android.view.accessibility.IAccessibilityInteractionConnectionCallback)30 SomeArgs (com.android.internal.os.SomeArgs)30 Region (android.graphics.Region)25 Paint (android.graphics.Paint)19 View (android.view.View)12 ViewRootImpl (android.view.ViewRootImpl)11 RemoteView (android.widget.RemoteViews.RemoteView)11 Display (android.view.Display)10 File (java.io.File)10 LinkedList (java.util.LinkedList)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 UiAutomation (android.app.UiAutomation)5 InputFilter (android.text.InputFilter)5 TextPaint (android.text.TextPaint)5