当前位置: 首页>>代码示例>>Java>>正文


Java PointerCoords类代码示例

本文整理汇总了Java中android.view.MotionEvent.PointerCoords的典型用法代码示例。如果您正苦于以下问题:Java PointerCoords类的具体用法?Java PointerCoords怎么用?Java PointerCoords使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PointerCoords类属于android.view.MotionEvent包,在下文中一共展示了PointerCoords类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildMouseEvents

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
private void buildMouseEvents(PointerCoords coords, int clickCount) {
		long currMS = System.currentTimeMillis();
		
//							mousePressed
		MouseEvent swingMouseEvent = 
			new MouseEvent(JTable.this, MouseEvent.MOUSE_PRESSED, 
					currMS, 0, (int)coords.x, (int)coords.y, clickCount, false, MouseEvent.BUTTON1);
		JTable.this.processMouseEventAdAPI(swingMouseEvent);
		
		//mouseReleased
		swingMouseEvent = 
				new MouseEvent(JTable.this, MouseEvent.MOUSE_RELEASED, 
						currMS, 0, (int)coords.x, (int)coords.y, clickCount, false, MouseEvent.BUTTON1);
		JTable.this.processMouseEventAdAPI(swingMouseEvent);

		//mouseClicked
		MouseEvent clickEvent = 
				new MouseEvent(JTable.this, MouseEvent.MOUSE_CLICKED, 
						currMS, 0, (int)coords.x, (int)coords.y, clickCount, false, MouseEvent.BUTTON1);
		JTable.this.processMouseEventAdAPI(clickEvent);
	}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:22,代码来源:JTable.java

示例2: applyMovements

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
/**
 * Applies all changes that were set via {@link #setMovement(int, float, float) the setMovement(...)} method.
 */
public void applyMovements() {
    int pointerCount = pointerIds.size();

    PointerCoords[] coords = new PointerCoords[pointerCount];
    PointerProperties[] properties = new PointerProperties[pointerCount];

    int i = 0;
    for (Integer pointerId : pointerIds) {
        coords[i] = pointerPositionsMap.get(pointerId);
        properties[i] = pointerPropertiesMap.get(pointerId);
        i++;
    }

    injectMultipointMotionEvent(coords, properties);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:19,代码来源:MotionEventSender.java

示例3: injectMultipointMotionEvent

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
private void injectMultipointMotionEvent(PointerCoords[] coords, PointerProperties[] properties) {
    int pointerCount = coords.length;
    long now = SystemClock.uptimeMillis();

    MotionEvent event = MotionEvent.obtain(now, now, // when the event happened
                                           MotionEvent.ACTION_MOVE, // event type
                                           pointerCount, // number of pointers
                                           properties, // pointer properties
                                           coords, // pointer coordinate descriptors
                                           DEFAULT_META_STATE,
                                           0,
                                           DEFAULT_PRECISION_X,
                                           DEFAULT_PRECISION_Y,
                                           DEVICE_ID,
                                           DEFAULT_EDGE_FLAGS,
                                           DEFAULT_INPUT_SOURCE,
                                           0 // no flags
    );

    injectMethodFacade(event);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:22,代码来源:MotionEventSender.java

示例4: setPointer

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
@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;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:MotionEventSynthesizer.java

示例5: TouchPointer

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
TouchPointer(int startX, int startY, int deltaX, int deltaY,
        int id, float scale) {
    mStartX = startX * scale;
    mStartY = startY * scale;

    mDeltaX = deltaX * scale;
    mDeltaY = deltaY * scale;

    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;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:26,代码来源:GenericTouchGesture.java

示例6: GenericTouchGesture

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
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();

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

    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();
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:20,代码来源:GenericTouchGesture.java

示例7: GenericTouchGesture

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
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();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:GenericTouchGesture.java

示例8: setPointer

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
@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 = mContentViewCore.getRenderCoordinates().getDeviceScaleFactor();

    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;
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:18,代码来源:TouchEventSynthesizer.java

示例9: transformEventOld

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
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;
}
 
开发者ID:GcsSloop,项目名称:ViewSupport,代码行数:33,代码来源:MotionEventHelper.java

示例10: getPointerCoords

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
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;
}
 
开发者ID:GcsSloop,项目名称:ViewSupport,代码行数:10,代码来源:MotionEventHelper.java

示例11: setMovement

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
/**
 * Sets the next position of a specified pointer.
 * 
 * @param pointerId
 *        - the pointer ID which has changed it's position.
 * @param toX
 *        - the new X pointer position.
 * @param toY
 *        - the new Y pointer position.
 */
public void setMovement(int pointerId, float toX, float toY) {
    if (!pointerPositionsMap.containsKey(pointerId)) {
        return;
    }

    PointerCoords pointerPosition = pointerPositionsMap.get(pointerId);
    pointerPosition.x = toX;
    pointerPosition.y = toY;

    // pointerPositionsMap.put(pointerId, pointerPosition);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:22,代码来源:MotionEventSender.java

示例12: injectFingerRegisterEvent

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
private void injectFingerRegisterEvent(int newPointerId) {
    int pointerCount = pointerIds.size();
    int action = pointerCount == 1 ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;

    PointerCoords[] coords = new PointerCoords[pointerCount];
    PointerProperties[] properties = new PointerProperties[pointerCount];

    int i = 0;
    for (Integer pointerId : pointerIds) {
        coords[i] = pointerPositionsMap.get(pointerId);
        properties[i] = pointerPropertiesMap.get(pointerId);
        i++;
    }

    long now = SystemClock.uptimeMillis();
    MotionEvent event = MotionEvent.obtain(now,
                                           now,
                                           action,
                                           pointerCount,
                                           properties,
                                           coords,
                                           DEFAULT_META_STATE,
                                           0,
                                           DEFAULT_PRECISION_X,
                                           DEFAULT_PRECISION_Y,
                                           DEVICE_ID,
                                           DEFAULT_EDGE_FLAGS,
                                           DEFAULT_INPUT_SOURCE,
                                           0);

    if (action == MotionEvent.ACTION_POINTER_DOWN) {
        int newPointerIndex = event.findPointerIndex(newPointerId);
        event.setAction(action | (newPointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT));
    }

    injectMethodFacade(event);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:38,代码来源:MotionEventSender.java

示例13: injectFingerUnregisterEvent

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
private void injectFingerUnregisterEvent(int upPointerId) {
    int pointerCount = pointerIds.size();
    int action = pointerCount == 1 ? MotionEvent.ACTION_UP : MotionEvent.ACTION_POINTER_UP;

    PointerCoords[] coords = new PointerCoords[pointerCount];
    PointerProperties[] properties = new PointerProperties[pointerCount];

    int i = 0;
    for (Integer pointerId : pointerIds) {
        coords[i] = pointerPositionsMap.get(pointerId);
        properties[i] = pointerPropertiesMap.get(pointerId);
        if (upPointerId == pointerId) {
            coords[i].pressure = 0.0f;
        }
        i++;
    }

    long now = SystemClock.uptimeMillis();
    MotionEvent event = MotionEvent.obtain(now,
                                           now,
                                           action,
                                           pointerCount,
                                           properties,
                                           coords,
                                           DEFAULT_META_STATE,
                                           0,
                                           DEFAULT_PRECISION_X,
                                           DEFAULT_PRECISION_Y,
                                           DEVICE_ID,
                                           DEFAULT_EDGE_FLAGS,
                                           DEFAULT_INPUT_SOURCE,
                                           0);

    if (action == MotionEvent.ACTION_POINTER_UP) {
        int newPointerIndex = event.findPointerIndex(upPointerId);
        event.setAction(action | (newPointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT));
    }

    injectMethodFacade(event);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:41,代码来源:MotionEventSender.java

示例14: toMotionEventInputParams

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
private static MotionInputEventParams toMotionEventInputParams(
        final int actionCode, final PointerCoords coordinates, final int button,
        final PointerProperties properties, final long startDelta) {
    final MotionInputEventParams evtParams = new MotionInputEventParams();
    evtParams.actionCode = actionCode;
    evtParams.coordinates = coordinates;
    evtParams.button = button;
    evtParams.properties = properties;
    evtParams.startDelta = startDelta;
    return evtParams;
}
 
开发者ID:appium,项目名称:appium-uiautomator2-server,代码行数:12,代码来源:ActionsHelpers.java

示例15: parsePointerCoords

import android.view.MotionEvent.PointerCoords; //导入依赖的package包/类
private PointerCoords[][] parsePointerCoords(final IHttpRequest request)
        throws JSONException {
    final JSONArray actions = (org.json.JSONArray) getPayload(request).get("actions");

    final double time = computeLongestTime(actions);

    final PointerCoords[][] pcs = new PointerCoords[actions.length()][];
    for (int i = 0; i < actions.length(); i++) {
        final JSONArray gestures = actions.getJSONArray(i);

        pcs[i] = gesturesToPointerCoords(time, gestures);
    }

    return pcs;
}
 
开发者ID:appium,项目名称:appium-uiautomator2-server,代码行数:16,代码来源:MultiPointerGesture.java


注:本文中的android.view.MotionEvent.PointerCoords类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。