Android Open Source - valence Touch Pad Event






From Project

Back to project page valence.

License

The source code is released under:

Apache License

If you think the Android project valence listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2011 David Simmons//from www. j  ava 2 s  .c o  m
 * http://cafbit.com/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 *
 */
package com.cafbit.valence;

import com.cafbit.valence.TouchPadHandler.Touch;

public class TouchPadEvent {
    long dt = 0L;
    float dx = 0.0f, dy = 0.0f;
    boolean button1 = false;
    boolean button2 = false;
    float sx = 0.0f; // scroll x
    float sy = 0.0f; // scroll y

    public static TouchPadEvent[] tap(boolean multiTouchTap) {
        TouchPadEvent events[] = new TouchPadEvent[2];
        events[0] = new TouchPadEvent();
        if (multiTouchTap) {
            events[0].button2 = true;
        } else {
            events[0].button1 = true;
        }
        events[1] = new TouchPadEvent();
        return events;
    }

    public static TouchPadEvent move(Touch touch) {
        TouchPadEvent event = new TouchPadEvent();
        event.dt = touch.dt;
        event.dx = touch.dx;
        event.dy = touch.dy;
        return event;
    }

    public static TouchPadEvent[] startDrag(Touch touch) {
        TouchPadEvent events[] = new TouchPadEvent[2];
        events[0] = new TouchPadEvent();
        events[0].button1 = true;
        events[1] = new TouchPadEvent();
        events[1].dt = touch.dt;
        events[1].dx = touch.dx;
        events[1].dy = touch.dy;
        events[1].button1 = true;
        return events;
    }

    public static TouchPadEvent drag(Touch touch) {
        TouchPadEvent event = new TouchPadEvent();
        event.dt = touch.dt;
        event.dx = touch.dx;
        event.dy = touch.dy;
        event.button1 = true;
        return event;
    }

    public static TouchPadEvent scroll(Touch touch) {
        TouchPadEvent event = new TouchPadEvent();
        event.sx = touch.sx;
        event.sy = touch.sy;
        return event;
    }

    public static TouchPadEvent clear() {
        return new TouchPadEvent();
    }

    public void debug() {
        System.out.printf("TouchPadEvent dt=%d dx=%f dy=%f b1=%b b2=%b vs=%f hs=%f\n",
            dt, dx, dy,
            button1, button2,
            sy, sx
        );
    }
}




Java Source Code List

com.cafbit.valence.HelpActivity.java
com.cafbit.valence.MoteContextImpl.java
com.cafbit.valence.OptionsMenuHelper.java
com.cafbit.valence.RFBRecvThread.java
com.cafbit.valence.RFBThread.java
com.cafbit.valence.SelectionActivity.java
com.cafbit.valence.TouchPadEvent.java
com.cafbit.valence.TouchPadHandler.java
com.cafbit.valence.TouchPadView.java
com.cafbit.valence.ValenceActivity.java
com.cafbit.valence.ValenceApplication.java
com.cafbit.valence.ValenceIOException.java
com.cafbit.valence.device.ValenceDeviceClass.java
com.cafbit.valence.device.ValenceDeviceSetupView.java
com.cafbit.valence.device.ValenceDevice.java
com.cafbit.valence.device.ValenceMDNSDiscoveryHandler.java
com.cafbit.valence.rfb.DES.java
com.cafbit.valence.rfb.KeyTranslator.java
com.cafbit.valence.rfb.RFBConnection.java
com.cafbit.valence.rfb.RFBEvent.java
com.cafbit.valence.rfb.RFBException.java
com.cafbit.valence.rfb.RFBKeyEvent.java
com.cafbit.valence.rfb.RFBMessage.java
com.cafbit.valence.rfb.RFBPointerEvent.java
com.cafbit.valence.rfb.RFBSecurityARD.java
com.cafbit.valence.rfb.RFBSecurityNone.java
com.cafbit.valence.rfb.RFBSecurityVNC.java
com.cafbit.valence.rfb.RFBSecurity.java
com.cafbit.valence.rfb.RFBStream.java
com.cafbit.valence.rfb.Security.java
com.cafbit.valence.rfb.Util.java
com.cafbit.valence.rfb.Version.java