android.view.MotionEvent.PointerCoords Java Examples

The following examples show how to use android.view.MotionEvent.PointerCoords. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
GenericTouchGesture(ContentViewCore contentViewCore,
        int startX0, int startY0, int deltaX0, int deltaY0,
        int startX1, int startY1, int deltaX1, int deltaY1) {
    mContentViewCore = contentViewCore;

    float scale = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();
    int scaledTouchSlop = getScaledTouchSlop();

    mPointers = new TouchPointer[2];
    mPointers[0] = new TouchPointer(startX0, startY0, deltaX0, deltaY0, 0,
        scale, scaledTouchSlop);
    mPointers[1] = new TouchPointer(startX1, startY1, deltaX1, deltaY1, 1,
        scale, scaledTouchSlop);

    mPointerProperties = new PointerProperties[2];
    mPointerProperties[0] = mPointers[0].getProperties();
    mPointerProperties[1] = mPointers[1].getProperties();

    mPointerCoords = new PointerCoords[2];
    mPointerCoords[0] = mPointers[0].getCoords();
    mPointerCoords[1] = mPointers[1].getCoords();
}
 
Example #2
Source File: ComplexUiActionHandler.java    From android-uiconductor with Apache License 2.0 6 votes vote down vote up
/** Helper function to obtain a MotionEvent. */
private static MotionEvent getMotionEvent(long downTime, long eventTime, int action,
    float x, float y) {

  PointerProperties properties = new PointerProperties();
  properties.id = 0;
  properties.toolType = Configurator.getInstance().getToolType();

  PointerCoords coords = new PointerCoords();
  coords.pressure = 1;
  coords.size = 1;
  coords.x = x;
  coords.y = y;

  return MotionEvent.obtain(downTime, eventTime, action, 1,
      new PointerProperties[] { properties }, new PointerCoords[] { coords },
      0, 0, 1.0f, 1.0f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
}
 
Example #3
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
GenericTouchGesture(ContentViewCore contentViewCore,
        int startX, int startY, int deltaX, int deltaY) {
    mContentViewCore = contentViewCore;

    float scale = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();
    int scaledTouchSlop = getScaledTouchSlop();

    mPointers = new TouchPointer[1];
    mPointers[0] = new TouchPointer(startX, startY, deltaX, deltaY, 0,
        scale, scaledTouchSlop);

    mPointerProperties = new PointerProperties[1];
    mPointerProperties[0] = mPointers[0].getProperties();

    mPointerCoords = new PointerCoords[1];
    mPointerCoords[0] = mPointers[0].getCoords();
}
 
Example #4
Source File: MotionEventBuilder.java    From android-test with Apache License 2.0 6 votes vote down vote up
/** Returns a MotionEvent with the provided data or reasonable defaults. */
public MotionEvent build() {
  if (pointerPropertiesList.size() == 0) {
    setPointer(0, 0);
  }
  if (actionIndex != -1) {
    action = action | (actionIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT);
  }
  return MotionEvent.obtain(
      downTime,
      eventTime,
      action,
      pointerPropertiesList.size(),
      pointerPropertiesList.toArray(new PointerProperties[pointerPropertiesList.size()]),
      pointerCoordsList.toArray(new MotionEvent.PointerCoords[pointerCoordsList.size()]),
      metaState,
      buttonState,
      xPrecision,
      yPrecision,
      deviceId,
      edgeFlags,
      source,
      flags);
}
 
Example #5
Source File: MotionEventSynthesizer.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@CalledByNative
void setPointer(int index, int x, int y, int id) {
    assert (0 <= index && index < MAX_NUM_POINTERS);

    // Convert coordinates from density independent pixels to density dependent pixels.
    float scaleFactor = getDisplay().getDipScale();

    PointerCoords coords = new PointerCoords();
    coords.x = scaleFactor * x;
    coords.y = scaleFactor * y;
    coords.pressure = 1.0f;
    mPointerCoords[index] = coords;

    PointerProperties properties = new PointerProperties();
    properties.id = id;
    mPointerProperties[index] = properties;
}
 
Example #6
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
GenericTouchGesture(ContentViewCore contentViewCore,
        int startX, int startY, int deltaX, int deltaY) {
    mContentViewCore = contentViewCore;

    float scale = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();
    int scaledTouchSlop = getScaledTouchSlop();

    mPointers = new TouchPointer[1];
    mPointers[0] = new TouchPointer(startX, startY, deltaX, deltaY, 0,
        scale, scaledTouchSlop);

    mPointerProperties = new PointerProperties[1];
    mPointerProperties[0] = mPointers[0].getProperties();

    mPointerCoords = new PointerCoords[1];
    mPointerCoords[0] = mPointers[0].getCoords();
}
 
Example #7
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
GenericTouchGesture(ContentViewCore contentViewCore,
        int startX0, int startY0, int deltaX0, int deltaY0,
        int startX1, int startY1, int deltaX1, int deltaY1) {
    mContentViewCore = contentViewCore;

    float scale = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();
    int scaledTouchSlop = getScaledTouchSlop();

    mPointers = new TouchPointer[2];
    mPointers[0] = new TouchPointer(startX0, startY0, deltaX0, deltaY0, 0,
        scale, scaledTouchSlop);
    mPointers[1] = new TouchPointer(startX1, startY1, deltaX1, deltaY1, 1,
        scale, scaledTouchSlop);

    mPointerProperties = new PointerProperties[2];
    mPointerProperties[0] = mPointers[0].getProperties();
    mPointerProperties[1] = mPointers[1].getProperties();

    mPointerCoords = new PointerCoords[2];
    mPointerCoords[0] = mPointers[0].getCoords();
    mPointerCoords[1] = mPointers[1].getCoords();
}
 
Example #8
Source File: MotionEventSubject.java    From android-test with Apache License 2.0 5 votes vote down vote up
public PointerCoordsSubject historicalPointerCoords(int pointerIndex, int pos) {
  PointerCoords outPointerCoords = new PointerCoords();
  actual.getHistoricalPointerCoords(pointerIndex, pos, outPointerCoords);
  return check("getHistoricalPointerCoords(%s, %s)", pointerIndex, pos)
      .about(PointerCoordsSubject.pointerCoords())
      .that(outPointerCoords);
}
 
Example #9
Source File: MotionEventSubject.java    From android-test with Apache License 2.0 5 votes vote down vote up
public PointerCoordsSubject pointerCoords(int pointerIndex) {
  PointerCoords outPointerCoords = new PointerCoords();
  actual.getPointerCoords(pointerIndex, outPointerCoords);
  return check("getPointerCoords(%s)", pointerIndex)
      .about(PointerCoordsSubject.pointerCoords())
      .that(outPointerCoords);
}
 
Example #10
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
TouchPointer(int startX, int startY, int deltaX, int deltaY,
        int id, float scale, int scaledTouchSlop) {
    mStartX = startX * scale;
    mStartY = startY * scale;

    float scaledDeltaX = deltaX * scale;
    float scaledDeltaY = deltaY * scale;

    if (scaledDeltaX != 0 || scaledDeltaY != 0) {
        // The touch handler only considers a pointer as moving once
        // it's been moved by more than scaledTouchSlop pixels. We
        // thus increase the delta distance so the move is actually
        // registered as covering the specified distance.
        float distance = (float)Math.sqrt(scaledDeltaX * scaledDeltaX +
                scaledDeltaY * scaledDeltaY);
        mDeltaX = scaledDeltaX * (1 + scaledTouchSlop / distance);
        mDeltaY = scaledDeltaY * (1 + scaledTouchSlop / distance);
    }
    else {
        mDeltaX = scaledDeltaX;
        mDeltaY = scaledDeltaY;
    }

    if (deltaX != 0 || deltaY != 0) {
        mStepX = mDeltaX / Math.abs(mDeltaX + mDeltaY);
        mStepY = mDeltaY / Math.abs(mDeltaX + mDeltaY);
    } else {
        mStepX = 0;
        mStepY = 0;
    }

    mProperties = new PointerProperties();
    mProperties.id = id;
    mProperties.toolType = MotionEvent.TOOL_TYPE_FINGER;

    mCoords = new PointerCoords();
    mCoords.x = mStartX;
    mCoords.y = mStartY;
    mCoords.pressure = 1.0f;
}
 
Example #11
Source File: PointerCoordsBuilder.java    From android-test with Apache License 2.0 5 votes vote down vote up
public PointerCoords build() {
  final PointerCoords pointerCoords = new PointerCoords();
  pointerCoords.x = x;
  pointerCoords.y = y;
  pointerCoords.pressure = pressure;
  pointerCoords.size = size;
  pointerCoords.touchMajor = touchMajor;
  pointerCoords.touchMinor = touchMinor;
  pointerCoords.toolMajor = toolMajor;
  pointerCoords.toolMinor = toolMinor;
  pointerCoords.orientation = orientation;
  return pointerCoords;
}
 
Example #12
Source File: MotionEventBuilder.java    From android-test with Apache License 2.0 5 votes vote down vote up
/**
 * An expanded variant of {@link #setPointer(float, float)} that supports specifying all pointer
 * properties and coords data.
 */
public MotionEventBuilder setPointer(
    PointerProperties pointerProperties, PointerCoords pointerCoords) {
  pointerPropertiesList.add(pointerProperties);
  pointerCoordsList.add(pointerCoords);
  return this;
}
 
Example #13
Source File: MotionEventBuilder.java    From android-test with Apache License 2.0 5 votes vote down vote up
/**
 * Simple mechanism to add a pointer to the MotionEvent.
 *
 * <p>Can be called multiple times to add multiple pointers to the event.
 */
public MotionEventBuilder setPointer(float x, float y) {
  PointerProperties pointerProperties = new PointerProperties();
  pointerProperties.id = pointerPropertiesList.size();
  PointerCoords pointerCoords = new PointerCoords();
  pointerCoords.x = x;
  pointerCoords.y = y;
  return setPointer(pointerProperties, pointerCoords);
}
 
Example #14
Source File: InteractionController.java    From appium-uiautomator2-server with Apache License 2.0 5 votes vote down vote up
public Boolean performMultiPointerGesture(final PointerCoords[][] pcs) throws UiAutomator2Exception {
    if (shouldTrackScrollEvents()) {
        return EventRegister.runAndRegisterScrollEvents(new ReturningRunnable<Boolean>() {
            @Override
            public void run() {
                setResult(doPerformMultiPointerGesture(pcs));
            }
        });
    } else {
        return doPerformMultiPointerGesture(pcs);
    }
}
 
Example #15
Source File: MultiPointerGesture.java    From appium-uiautomator2-server with Apache License 2.0 5 votes vote down vote up
private PointerCoords toPointerCoords(TouchGestureModel gesture) {
    final TouchLocationModel touch = gesture.touch;
    final PointerCoords p = new PointerCoords();
    p.size = 1;
    p.pressure = 1;
    p.x = touch.x.intValue();
    p.y = touch.y.intValue();
    return p;
}
 
Example #16
Source File: MultiPointerGesture.java    From appium-uiautomator2-server with Apache License 2.0 5 votes vote down vote up
private PointerCoords[] gesturesToPointerCoords(final double maxTime, List<TouchGestureModel> gestures) {
    // gestures, e.g.:
    // [
    // {"touch":{"y":529.5,"x":120},"time":0.2},
    // {"touch":{"y":529.5,"x":130},"time":0.4},
    // {"touch":{"y":454.5,"x":140},"time":0.6},
    // {"touch":{"y":304.5,"x":150},"time":0.8}
    // ]

    // From the docs:
    // "Steps are injected about 5 milliseconds apart, so 100 steps may take
    // around 0.5 seconds to complete."
    final int steps = (int) (maxTime * 200) + 2;
    final PointerCoords[] pc = new PointerCoords[steps];
    TouchGestureModel current = gestures.get(0);
    int gestureIndex = 1;
    double currentTime = current.time;
    double runningTime = 0.0;
    for (int step = 0; step < steps; step++) {
        if (runningTime > currentTime && gestureIndex < gestures.size()) {
            current = gestures.get(gestureIndex++);
            currentTime = current.time;
        }
        pc[step] = toPointerCoords(current);
        runningTime += INTERSTEP_DELAY_SEC;
    }
    return pc;
}
 
Example #17
Source File: MultiPointerGesture.java    From appium-uiautomator2-server with Apache License 2.0 5 votes vote down vote up
private PointerCoords[][] parsePointerCoords(final IHttpRequest request) {
    TouchActionsModel model = toModel(request, TouchActionsModel.class);
    final double time = computeLongestTime(model.actions);
    final PointerCoords[][] pcs = new PointerCoords[model.actions.size()][];
    for (int i = 0; i < model.actions.size(); i++) {
        final List<TouchGestureModel> gestures = model.actions.get(i);
        pcs[i] = gesturesToPointerCoords(time, gestures);
    }
    return pcs;
}
 
Example #18
Source File: MultiPointerGesture.java    From appium-uiautomator2-server with Apache License 2.0 5 votes vote down vote up
@Override
protected AppiumResponse safeHandle(IHttpRequest request) {
    final PointerCoords[][] pcs = parsePointerCoords(request);
    if (!UiAutomatorBridge.getInstance().getInteractionController().performMultiPointerGesture(pcs)) {
        throw new InvalidElementStateException("Unable to perform multi pointer gesture");
    }
    return new AppiumResponse(getSessionId(request));
}
 
Example #19
Source File: MotionEventHelper.java    From ViewSupport with Apache License 2.0 5 votes vote down vote up
private static PointerCoords[] getPointerCoords(MotionEvent e) {
    int n = e.getPointerCount();
    PointerCoords[] r = new PointerCoords[n];
    for (int i = 0; i < n; i++) {
        r[i] = new PointerCoords();
        e.getPointerCoords(i, r[i]);
    }
    return r;
}
 
Example #20
Source File: MotionEventHelper.java    From ViewSupport with Apache License 2.0 5 votes vote down vote up
private static MotionEvent transformEventOld(MotionEvent e, Matrix m) {
    long downTime = e.getDownTime();
    long eventTime = e.getEventTime();
    int action = e.getAction();
    int pointerCount = e.getPointerCount();
    int[] pointerIds = getPointerIds(e);
    PointerCoords[] pointerCoords = getPointerCoords(e);
    int metaState = e.getMetaState();
    float xPrecision = e.getXPrecision();
    float yPrecision = e.getYPrecision();
    int deviceId = e.getDeviceId();
    int edgeFlags = e.getEdgeFlags();
    int source = e.getSource();
    int flags = e.getFlags();
    // Copy the x and y coordinates into an array, map them, and copy back.
    float[] xy = new float[pointerCoords.length * 2];
    for (int i = 0; i < pointerCount;i++) {
        xy[2 * i] = pointerCoords[i].x;
        xy[2 * i + 1] = pointerCoords[i].y;
    }
    m.mapPoints(xy);
    for (int i = 0; i < pointerCount;i++) {
        pointerCoords[i].x = xy[2 * i];
        pointerCoords[i].y = xy[2 * i + 1];
        pointerCoords[i].orientation = transformAngle(
                m, pointerCoords[i].orientation);
    }
    MotionEvent n = MotionEvent.obtain(downTime, eventTime, action,
            pointerCount, pointerIds, pointerCoords, metaState, xPrecision,
            yPrecision, deviceId, edgeFlags, source, flags);
    return n;
}
 
Example #21
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
TouchPointer(int startX, int startY, int deltaX, int deltaY,
        int id, float scale, int scaledTouchSlop) {
    mStartX = startX * scale;
    mStartY = startY * scale;

    float scaledDeltaX = deltaX * scale;
    float scaledDeltaY = deltaY * scale;

    if (scaledDeltaX != 0 || scaledDeltaY != 0) {
        // The touch handler only considers a pointer as moving once
        // it's been moved by more than scaledTouchSlop pixels. We
        // thus increase the delta distance so the move is actually
        // registered as covering the specified distance.
        float distance = (float)Math.sqrt(scaledDeltaX * scaledDeltaX +
                scaledDeltaY * scaledDeltaY);
        mDeltaX = scaledDeltaX * (1 + scaledTouchSlop / distance);
        mDeltaY = scaledDeltaY * (1 + scaledTouchSlop / distance);
    }
    else {
        mDeltaX = scaledDeltaX;
        mDeltaY = scaledDeltaY;
    }

    if (deltaX != 0 || deltaY != 0) {
        mStepX = mDeltaX / Math.abs(mDeltaX + mDeltaY);
        mStepY = mDeltaY / Math.abs(mDeltaX + mDeltaY);
    } else {
        mStepX = 0;
        mStepY = 0;
    }

    mProperties = new PointerProperties();
    mProperties.id = id;
    mProperties.toolType = MotionEvent.TOOL_TYPE_FINGER;

    mCoords = new PointerCoords();
    mCoords.x = mStartX;
    mCoords.y = mStartY;
    mCoords.pressure = 1.0f;
}
 
Example #22
Source File: GestureController.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public Pointer(int id, Point point) {
    prop = new PointerProperties();
    prop.id = id;
    prop.toolType = MotionEvent.TOOL_TYPE_FINGER;
    coords = new PointerCoords();
    coords.pressure = 1;
    coords.size = 1;
    coords.x = point.x;
    coords.y = point.y;
}
 
Example #23
Source File: GestureController.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
/** Helper function to obtain a MotionEvent. */
private static MotionEvent getMotionEvent(long downTime, long eventTime, int action,
        List<PointerProperties> properties, List<PointerCoords> coordinates) {

    PointerProperties[] props = properties.toArray(new PointerProperties[properties.size()]);
    PointerCoords[] coords = coordinates.toArray(new PointerCoords[coordinates.size()]);
    return MotionEvent.obtain(downTime, eventTime, action, props.length, props, coords,
            0, 0, 1, 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
}
 
Example #24
Source File: GestureController.java    From za-Farmer with MIT License 5 votes vote down vote up
public Pointer(int id, Point point) {
    prop = new PointerProperties();
    prop.id = id;
    prop.toolType = MotionEvent.TOOL_TYPE_FINGER;
    coords = new PointerCoords();
    coords.pressure = 1;
    coords.size = 1;
    coords.x = point.x;
    coords.y = point.y;
}
 
Example #25
Source File: GestureController.java    From za-Farmer with MIT License 5 votes vote down vote up
/** Helper function to obtain a MotionEvent. */
private static MotionEvent getMotionEvent(long downTime, long eventTime, int action,
        List<PointerProperties> properties, List<PointerCoords> coordinates) {

    PointerProperties[] props = properties.toArray(new PointerProperties[properties.size()]);
    PointerCoords[] coords = coordinates.toArray(new PointerCoords[coordinates.size()]);
    return MotionEvent.obtain(downTime, eventTime, action, props.length, props, coords,
            0, 0, 1, 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
}
 
Example #26
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
PointerCoords getCoords() {
    return mCoords;
}
 
Example #27
Source File: GenericTouchGesture.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
PointerCoords getCoords() {
    return mCoords;
}
 
Example #28
Source File: MyInteractionController.java    From PUMA with Apache License 2.0 4 votes vote down vote up
/**
 * Performs a multi-touch gesture
 *
 * Takes a series of touch coordinates for at least 2 pointers. Each pointer must have
 * all of its touch steps defined in an array of {@link PointerCoords}. By having the ability
 * to specify the touch points along the path of a pointer, the caller is able to specify
 * complex gestures like circles, irregular shapes etc, where each pointer may take a
 * different path.
 *
 * To create a single point on a pointer's touch path
 * <code>
 *       PointerCoords p = new PointerCoords();
 *       p.x = stepX;
 *       p.y = stepY;
 *       p.pressure = 1;
 *       p.size = 1;
 * </code>
 * @param touches each array of {@link PointerCoords} constitute a single pointer's touch path.
 *        Multiple {@link PointerCoords} arrays constitute multiple pointers, each with its own
 *        path. Each {@link PointerCoords} in an array constitute a point on a pointer's path.
 * @return <code>true</code> if all points on all paths are injected successfully, <code>false
 *        </code>otherwise
 * @since API Level 18
 */
public boolean performMultiPointerGesture(PointerCoords[]... touches) {
	boolean ret = true;
	if (touches.length < 2) {
		throw new IllegalArgumentException("Must provide coordinates for at least 2 pointers");
	}

	// Get the pointer with the max steps to inject.
	int maxSteps = 0;
	for (int x = 0; x < touches.length; x++)
		maxSteps = (maxSteps < touches[x].length) ? touches[x].length : maxSteps;

	// specify the properties for each pointer as finger touch
	PointerProperties[] properties = new PointerProperties[touches.length];
	PointerCoords[] pointerCoords = new PointerCoords[touches.length];
	for (int x = 0; x < touches.length; x++) {
		PointerProperties prop = new PointerProperties();
		prop.id = x;
		prop.toolType = MotionEvent.TOOL_TYPE_FINGER;
		properties[x] = prop;

		// for each pointer set the first coordinates for touch down
		pointerCoords[x] = touches[x][0];
	}

	// Touch down all pointers
	long downTime = SystemClock.uptimeMillis();
	MotionEvent event;
	event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, 1, properties, pointerCoords, 0, 0, 1, 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
	ret &= injectEventSync(event);

	for (int x = 1; x < touches.length; x++) {
		event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), getPointerAction(MotionEvent.ACTION_POINTER_DOWN, x), x + 1, properties, pointerCoords, 0, 0, 1, 1, 0, 0,
				InputDevice.SOURCE_TOUCHSCREEN, 0);
		ret &= injectEventSync(event);
	}

	// Move all pointers
	for (int i = 1; i < maxSteps - 1; i++) {
		// for each pointer
		for (int x = 0; x < touches.length; x++) {
			// check if it has coordinates to move
			if (touches[x].length > i)
				pointerCoords[x] = touches[x][i];
			else
				pointerCoords[x] = touches[x][touches[x].length - 1];
		}

		event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_MOVE, touches.length, properties, pointerCoords, 0, 0, 1, 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);

		ret &= injectEventSync(event);
		SystemClock.sleep(MOTION_EVENT_INJECTION_DELAY_MILLIS);
	}

	// For each pointer get the last coordinates
	for (int x = 0; x < touches.length; x++)
		pointerCoords[x] = touches[x][touches[x].length - 1];

	// touch up
	for (int x = 1; x < touches.length; x++) {
		event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), getPointerAction(MotionEvent.ACTION_POINTER_UP, x), x + 1, properties, pointerCoords, 0, 0, 1, 1, 0, 0,
				InputDevice.SOURCE_TOUCHSCREEN, 0);
		ret &= injectEventSync(event);
	}

	Log.i(LOG_TAG, "x " + pointerCoords[0].x);
	// first to touch down is last up
	event = MotionEvent.obtain(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, 1, properties, pointerCoords, 0, 0, 1, 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
	ret &= injectEventSync(event);
	return ret;
}
 
Example #29
Source File: MotionEventSynthesizer.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public MotionEventSynthesizer(View target, WindowAndroidProvider windowProvider) {
    mTarget = target;
    mWindowProvider = windowProvider;
    mPointerProperties = new PointerProperties[MAX_NUM_POINTERS];
    mPointerCoords = new PointerCoords[MAX_NUM_POINTERS];
}
 
Example #30
Source File: PointerCoordsSubject.java    From android-test with Apache License 2.0 4 votes vote down vote up
private PointerCoordsSubject(
    FailureMetadata failureMetadata, @Nullable PointerCoords pointerProperties) {
  super(failureMetadata, pointerProperties);
  this.actual = pointerProperties;
}