All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.oscim.android.input.GestureHandler Maven / Gradle / Ivy

Go to download

OpenGL vector map library written in Java - running on Android, iOS, Desktop and within the browser.

There is a newer version: 0.22.0
Show newest version
package org.oscim.android.input;

import android.view.GestureDetector.OnDoubleTapListener;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;

import org.oscim.event.Gesture;
import org.oscim.map.Map;

public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
    private final AndroidMotionEvent mMotionEvent;
    private final Map mMap;

    public GestureHandler(Map map) {
        mMotionEvent = new AndroidMotionEvent();
        mMap = map;
    }

    /* GesturListener */

    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        //    return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
        return false;
    }

    @Override
    public void onShowPress(MotionEvent e) {
    }

    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        return false;
    }

    @Override
    public void onLongPress(MotionEvent e) {
        mMap.handleGesture(Gesture.LONG_PRESS, mMotionEvent.wrap(e));
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        return false;
    }

    @Override
    public boolean onDown(MotionEvent e) {
        return mMap.handleGesture(Gesture.PRESS, mMotionEvent.wrap(e));
    }

    /* DoubleTapListener */
    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
    }

    @Override
    public boolean onDoubleTapEvent(MotionEvent e) {
        return false;
    }

    @Override
    public boolean onDoubleTap(MotionEvent e) {
        return mMap.handleGesture(Gesture.DOUBLE_TAP, mMotionEvent.wrap(e));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy