//package djrain.lilochat.client;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import com.google.android.maps.MapView;
public class LiloMapView extends MapView
{
GestureDetector gd;
private OnLongClickListener onLongClickListener = new OnLongClickListener()
{
public boolean onLongClick(View v)
{
Log.e("djrain", "OnLongClickListener onLongClick:");
return false;
}
};
public LiloMapView(Context context, AttributeSet attrs)
{
super(context, attrs);
setBuiltInZoomControls(true);
this.setLongClickable(true);
this.setClickable(true);
Log.e("djrain", "OnLongClickListener isLongClickable():" + isLongClickable());
setOnLongClickListener(onLongClickListener);
gd = new GestureDetector(gestureListener);
}
OnGestureListener gestureListener = new OnGestureListener()
{
public boolean onSingleTapUp(MotionEvent e)
{
Log.i("djrain", "onSingleTapUp:"+e);
return false;
}
public void onShowPress(MotionEvent e)
{
Log.i("djrain", "onShowPress:"+e);
}
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
{
Log.i("djrain", "onScroll:"+e2);
return false;
}
public void onLongPress(MotionEvent e)
{
LiloGeocoder geo = new LiloGeocoder(getContext());
double [] lalo = new double[2];
LocationHelper.pixel2lalo(LiloMapView.this , e , lalo);
geo.getAddress(lalo);
Log.i("djrain", "onLongPress:"+e);
}
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
Log.i("djrain", "onFling:"+e2);
return false;
}
public boolean onDown(MotionEvent e)
{
Log.i("djrain", "onDown:"+e);
return false;
}
};
@Override
public boolean onTouchEvent(MotionEvent ev)
{
gd.onTouchEvent(ev);
return super.onTouchEvent(ev);
}
}