MonkeyMotionEventpublic class MonkeyMotionEvent extends MonkeyEvent
Fields Summary |
---|
private long | mDownTime | private long | mEventTime | private int | mAction | private float | mX | private float | mY | private float | mPressure | private float | mSize | private int | mMetaState | private float | mXPrecision | private float | mYPrecision | private int | mDeviceId | private int | mEdgeFlags | private boolean | mIntermediateNote |
Constructors Summary |
---|
public MonkeyMotionEvent(int type, long downAt, int action, float x, float y, int metaState)
super(type);
mDownTime = downAt;
mAction = action;
mX = x;
mY = y;
mMetaState = metaState;
| public MonkeyMotionEvent(int type, long downTime, long eventTime, int action, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)
super(type);
mDownTime = downTime;
mEventTime = eventTime;
mAction = action;
mX = x;
mY = y;
mPressure = pressure;
mSize = size;
mMetaState = metaState;
mXPrecision = xPrecision;
mYPrecision = yPrecision;
mDeviceId = deviceId;
mEdgeFlags = edgeFlags;
|
Methods Summary |
---|
public int | getAction()
return mAction;
| public long | getDownTime()
return mDownTime;
| private android.view.MotionEvent | getEvent()
if (mDeviceId < 0) {
return MotionEvent.obtain(mDownTime, SystemClock.uptimeMillis(),
mAction, mX, mY, mMetaState);
}
// for scripts
return MotionEvent.obtain(mDownTime, mEventTime,
mAction, mX, mY, mPressure, mSize, mMetaState,
mXPrecision, mYPrecision, mDeviceId, mEdgeFlags);
| public long | getEventTime()
return mEventTime;
| public boolean | getIntermediateNote()
return mIntermediateNote;
| public float | getX()
return mX;
| public float | getY()
return mY;
| public int | injectEvent(android.view.IWindowManager iwm, android.app.IActivityManager iam, int verbose)
String note;
if ((verbose > 0 && !mIntermediateNote) || verbose > 1) {
if (mAction == MotionEvent.ACTION_DOWN) {
note = "DOWN";
} else if (mAction == MotionEvent.ACTION_UP) {
note = "UP";
} else {
note = "MOVE";
}
System.out.println(":Sending Pointer ACTION_" + note +
" x=" + mX + " y=" + mY);
}
try {
int type = this.getEventType();
MotionEvent me = getEvent();
if ((type == MonkeyEvent.EVENT_TYPE_POINTER &&
!iwm.injectPointerEvent(me, false))
|| (type == MonkeyEvent.EVENT_TYPE_TRACKBALL &&
!iwm.injectTrackballEvent(me, false))) {
return MonkeyEvent.INJECT_FAIL;
}
} catch (RemoteException ex) {
return MonkeyEvent.INJECT_ERROR_REMOTE_EXCEPTION;
}
return MonkeyEvent.INJECT_SUCCESS;
| public void | setDownTime(long downTime)
mDownTime = downTime;
| public void | setEventTime(long eventTime)
mEventTime = eventTime;
| public void | setIntermediateNote(boolean b)
mIntermediateNote = b;
|
|