Package com.google.glass.companion.Proto

Examples of com.google.glass.companion.Proto.MotionEvent


        // TODO Auto-generated method stub
    }

    @Override
    public void onMouseEvent(int action, int x, int y, long downTime) {
        MotionEvent glassMotionEvent = GlassMessagingUtil.convertMouseEvent2MotionEvent(action, 100.0f * (float) x
                / (float) mScreencastPanel.getWidth(), 100.0f * (float) y / (float) mScreencastPanel.getHeight(),
                downTime);
        Envelope envelope = CompanionMessagingUtil.newEnvelope();
        envelope.motionC2G = glassMotionEvent;
        mGlassConnection.writeAsync(envelope);
View Full Code Here


    public static final int ACTION_DOWN = 0;
    public static final int ACTION_MOVE = 2;
    public static final int ACTION_UP = 1;

    public static MotionEvent convertMouseEvent2MotionEvent(int action, float x, float y, long downTime) {
        MotionEvent me = new MotionEvent();
        me.downTime = downTime;
        me.eventTime = System.currentTimeMillis();
        me.action = action;
        me.metaState = 0;
        me.buttonState = 0;
View Full Code Here

        float stepX = (endX - startX) / (float) SWIPE_STEP_COUNT;
        float stepY = (endY - startY) / (float) SWIPE_STEP_COUNT;

        long downTime = System.currentTimeMillis() - SWIPE_DURATION;
        long eventTime = downTime;
        MotionEvent downEvent = convertMouseEvent2MotionEvent(ACTION_DOWN, x, y, downTime);
        res.add(newMotionEventEnvelope(downEvent));
        for (int i = 0; i < SWIPE_STEP_COUNT - 1; i++) {
            x += stepX;
            y += stepY;
            eventTime += SWIPE_STEP_DURATION;
            MotionEvent moveEvent = convertMouseEvent2MotionEvent(ACTION_MOVE, x, y, downTime);
            moveEvent.eventTime = eventTime;
            res.add(newMotionEventEnvelope(moveEvent));
        }
        x += stepX;
        y += stepY;
        eventTime += SWIPE_STEP_DURATION;
        MotionEvent upEvent = convertMouseEvent2MotionEvent(ACTION_UP, x, y, downTime);
        upEvent.eventTime = eventTime;
        res.add(newMotionEventEnvelope(upEvent));
        return res;
    }
View Full Code Here

    public static final List<Envelope> getTapEvents() {
        List<Envelope> res = new ArrayList<Envelope>();
        float x = 33.3F;
        float y = 50.0F;
        long downTime = System.currentTimeMillis();
        MotionEvent downEvent = convertMouseEvent2MotionEvent(ACTION_DOWN, x, y, downTime);
        res.add(newMotionEventEnvelope(downEvent));
        MotionEvent upEvent = convertMouseEvent2MotionEvent(ACTION_UP, x, y, downTime);
        res.add(newMotionEventEnvelope(upEvent));
        return res;
    }
View Full Code Here

TOP

Related Classes of com.google.glass.companion.Proto.MotionEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.