Android Open Source - qshuttle_driver Map Gesture Detector Overlay






From Project

Back to project page qshuttle_driver.

License

The source code is released under:

MIT License

If you think the Android project qshuttle_driver 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

/**
 * //w w w.j  av a2 s  . c o m
 */
package com.qshuttle.car;


import com.amap.mapapi.map.MapView;
import com.amap.mapapi.map.Overlay;

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


/**
 * @author wangpeifeng
 *
 */
public class MapGestureDetectorOverlay extends Overlay implements
    OnGestureListener {

  private GestureDetector gestureDetector;
  private OnGestureListener onGestureListener;

   
  public MapGestureDetectorOverlay() {
    gestureDetector = new GestureDetector(this);
  }

   
  public MapGestureDetectorOverlay(OnGestureListener onGestureListener) {
    this();
    setOnGestureListener(onGestureListener);
  }


  public boolean onTouchEvent(MotionEvent event, MapView mapView) {
    if (gestureDetector.onTouchEvent(event)) {
      return true;
    }
    return false;
  }

  public boolean onDown(MotionEvent e) {
    if (onGestureListener != null) {
      return onGestureListener.onDown(e);
    }
    return false;
  }


  public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
      float velocityY) {
    // TODO Auto-generated method stub
    if (onGestureListener != null) {
      return onGestureListener.onFling(e1, e2, velocityX, velocityY);
    }
    return false;
  }

  public void onLongPress(MotionEvent e) {
    // TODO Auto-generated method stub
    if (onGestureListener != null) {
      onGestureListener.onLongPress(e);
    }
    
  }

  public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
      float distanceY) {
    // TODO Auto-generated method stub
    if (onGestureListener != null) {
      onGestureListener.onScroll(e1, e2, distanceX, distanceY);
    }
    return false;

  }

  public void onShowPress(MotionEvent e) {
    // TODO Auto-generated method stub
    if (onGestureListener != null) {
      onGestureListener.onShowPress(e);
    }
  
  }

  public boolean onSingleTapUp(MotionEvent e) {
    // TODO Auto-generated method stub
    if (onGestureListener != null) {
      onGestureListener.onSingleTapUp(e);
    }
    return false;

  }

  public boolean isLongpressEnabled() {
    return gestureDetector.isLongpressEnabled();
  }

  
  public void setIsLongpressEnabled(boolean isLongpressEnabled) {
    gestureDetector.setIsLongpressEnabled(isLongpressEnabled);
  }

  
  public OnGestureListener getOnGestureListener() {
    return onGestureListener;
  }

     
  public void setOnGestureListener(OnGestureListener onGestureListener) {
    this.onGestureListener = onGestureListener;
  }


}




Java Source Code List

com.qshuttle.car.ActivityAddress.java
com.qshuttle.car.ActivityInfoRequest.java
com.qshuttle.car.ActivityMain.java
com.qshuttle.car.ActivityOfflineMap.java
com.qshuttle.car.DataOperator.java
com.qshuttle.car.DataProvider.java
com.qshuttle.car.DatabaseHelper.java
com.qshuttle.car.ExpandableListAdapter.java
com.qshuttle.car.GPSLocationOverlay.java
com.qshuttle.car.HostSettingActivity.java
com.qshuttle.car.ListAdapterAddress.java
com.qshuttle.car.ListAdapter.java
com.qshuttle.car.LongPressPopupOverlay.java
com.qshuttle.car.MapGestureDetectorOverlay.java
com.qshuttle.car.OverlayMapLocation.java
com.qshuttle.car.PassengerScheduleOverlay.java
com.qshuttle.car.PrefProxy.java
com.qshuttle.car.ThreadHttpPost.java
com.qshuttle.car.ThreadTimer.java
com.qshuttle.car.TimerCallBack.java
com.qshuttle.car.Timer.java
com.qshuttle.car.Utilities.java
com.qshuttle.car.WebApi.java