Android Open Source - Geoloqi-Android-Geotracks Double Tap Map View






From Project

Back to project page Geoloqi-Android-Geotracks.

License

The source code is released under:

GNU General Public License

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

package com.geoloqi.geotracks.maps;
/*from   w w  w .j  a va  2 s. c  o m*/
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;

import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

/**
 * This is an implementation of {@link MapView} that adds a
 * {@link SimpleOnGestureListener} to support double-tap to zoom
 * functionality.
 * 
 * @author Tristan Waddington
 */
public class DoubleTapMapView extends MapView {
    private GestureDetector mGestureDetector;
    
    public DoubleTapMapView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mGestureDetector = new GestureDetector(context, mDoubleTapListener);
    }
    
    public DoubleTapMapView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mGestureDetector = new GestureDetector(context, mDoubleTapListener);
    }
    
    public DoubleTapMapView(Context context, String apiKey) {
        super(context, apiKey);
        mGestureDetector = new GestureDetector(context, mDoubleTapListener);
    }
    
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return mGestureDetector.onTouchEvent(event) || super.onTouchEvent(event);
    }
    
    private SimpleOnGestureListener mDoubleTapListener = new SimpleOnGestureListener() {
        @Override
        public boolean onDoubleTap(MotionEvent e) {
            MapController mc = getController();
            if (mc != null) {
                return mc.zoomInFixing((int) e.getX(), (int) e.getY());
            }
            return false;
        }
    };

}




Java Source Code List

com.geoloqi.geotracks.Build.java
com.geoloqi.geotracks.app.SimpleAlertDialogFragment.java
com.geoloqi.geotracks.maps.DoubleTapMapView.java
com.geoloqi.geotracks.receiver.LocationBroadcastReceiver.java
com.geoloqi.geotracks.ui.LauncherActivity.java
com.geoloqi.geotracks.ui.LinkListActivity.java
com.geoloqi.geotracks.ui.MainActivity.java
com.geoloqi.geotracks.ui.NewShareLinkActivity.java
com.geoloqi.geotracks.ui.SettingsActivity.java
com.geoloqi.geotracks.ui.SignInActivity.java
com.geoloqi.geotracks.ui.SignUpActivity.java
com.geoloqi.geotracks.utils.FileUtils.java
com.geoloqi.geotracks.utils.LocationUtils.java
com.geoloqi.geotracks.widget.BaseViewHolder.java
com.geoloqi.geotracks.widget.ImageViewHolder.java
com.geoloqi.geotracks.widget.LazyImageLoader.java
com.geoloqi.geotracks.widget.LinkListAdapter.java