This commit is contained in:
Brad Leege
2015-08-31 16:41:52 -05:00
2 changed files with 32 additions and 1 deletions

View File

@@ -160,6 +160,25 @@ public class MapView extends FrameLayout implements LocationListener {
// Used to manage Event Listeners
private ArrayList<OnMapChangedListener> mOnMapChangedListener;
public interface OnFlingListener {
void onFling();
}
public interface OnScrollListener {
void onScroll();
}
private OnFlingListener onFlingListener;
private OnScrollListener onScrollListener;
public void setOnScrollListener(OnScrollListener onScrollListener) {
this.onScrollListener = onScrollListener;
}
public void setOnFlingListener(OnFlingListener onFlingListener) {
this.onFlingListener = onFlingListener;
}
//
// Properties
//
@@ -955,6 +974,8 @@ public class MapView extends FrameLayout implements LocationListener {
List<Annotation> annotations = getAnnotationsInBounds(bbox);
performClick();
return true;
}
@@ -968,6 +989,7 @@ public class MapView extends FrameLayout implements LocationListener {
@Override
public void onLongPress(MotionEvent e) {
// TODO
performLongClick();
}
// Called for flings
@@ -995,6 +1017,10 @@ public class MapView extends FrameLayout implements LocationListener {
mNativeMapView.moveBy(velocityX * duration / 2.0 / mScreenDensity, velocityY * duration / 2.0 / mScreenDensity, (long) (duration * 1000.0f));
if(onFlingListener != null){
onFlingListener.onFling();
}
return true;
}
@@ -1012,6 +1038,11 @@ public class MapView extends FrameLayout implements LocationListener {
// Scroll the map
mNativeMapView.moveBy(-distanceX / mScreenDensity, -distanceY / mScreenDensity);
if(onScrollListener != null){
onScrollListener.onScroll();
}
return true;
}
}