[android] #3746 - InfoWindowCloseListener
This commit is contained in:
@@ -194,7 +194,6 @@ public class InfoWindow {
|
||||
View view = mView.get();
|
||||
if (view != null) {
|
||||
((ViewGroup) view.getParent()).removeView(view);
|
||||
setBoundMarker(null);
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
@@ -223,7 +222,12 @@ public class InfoWindow {
|
||||
private void onClose() {
|
||||
MapboxMap mapboxMap = mMapboxMap.get();
|
||||
if (mapboxMap != null) {
|
||||
MapboxMap.OnInfoWindowCloseListener listener = mapboxMap.getOnInfoWindowCloseListener();
|
||||
if(listener!=null){
|
||||
listener.onInfoWindowClose(getBoundMarker());
|
||||
}
|
||||
mapboxMap.deselectMarker(getBoundMarker());
|
||||
setBoundMarker(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class MapboxMap {
|
||||
private MapboxMap.OnMarkerClickListener mOnMarkerClickListener;
|
||||
private MapboxMap.OnInfoWindowClickListener mOnInfoWindowClickListener;
|
||||
private MapboxMap.OnInfoWindowLongClickListener mOnInfoWindowLongClickListener;
|
||||
private MapboxMap.OnInfoWindowCloseListener mOnInfoWindowCloseListener;
|
||||
private MapboxMap.OnFlingListener mOnFlingListener;
|
||||
private MapboxMap.OnScrollListener mOnScrollListener;
|
||||
private MapboxMap.OnMyLocationTrackingModeChangeListener mOnMyLocationTrackingModeChangeListener;
|
||||
@@ -904,6 +905,7 @@ public class MapboxMap {
|
||||
*
|
||||
* @return Current active InfoWindow Click Listener
|
||||
*/
|
||||
@UiThread
|
||||
public OnInfoWindowClickListener getOnInfoWindowClickListener() {
|
||||
return mOnInfoWindowClickListener;
|
||||
}
|
||||
@@ -927,6 +929,20 @@ public class MapboxMap {
|
||||
return mOnInfoWindowLongClickListener;
|
||||
}
|
||||
|
||||
public void setOnInfoWindowCloseListener(@Nullable OnInfoWindowCloseListener listener) {
|
||||
mOnInfoWindowCloseListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the InfoWindow close listener
|
||||
*
|
||||
* @return Current active InfoWindow Close Listener
|
||||
*/
|
||||
@UiThread
|
||||
public OnInfoWindowCloseListener getOnInfoWindowCloseListener() {
|
||||
return mOnInfoWindowCloseListener;
|
||||
}
|
||||
|
||||
//
|
||||
// User location
|
||||
//
|
||||
@@ -1240,6 +1256,21 @@ public class MapboxMap {
|
||||
void onInfoWindowLongClick(Marker marker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback interface for close events on a marker's info window.
|
||||
*
|
||||
* @see MapboxMap#setOnInfoWindowCloseListener(OnInfoWindowCloseListener)
|
||||
*/
|
||||
public interface OnInfoWindowCloseListener {
|
||||
|
||||
/**
|
||||
* Called when the marker's info window is closed.
|
||||
*
|
||||
* @param marker The marker of the info window that was closed.
|
||||
*/
|
||||
void onInfoWindowClose(Marker marker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface definition for a callback to be invoked when an info window will be shown.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user