Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
* <p>
* Inspired by https://github.com/googlemaps/android-maps-utils.
* </p>
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public class MarkerManager implements MapboxMap.OnInfoWindowClickListener, MapboxMap.OnMarkerClickListener,
MapboxMap.InfoWindowAdapter {

Expand All @@ -30,10 +32,12 @@ public class MarkerManager implements MapboxMap.OnInfoWindowClickListener, Mapbo
private final Map<String, Collection> mNamedCollections = new HashMap<String, Collection>();
private final Map<Marker, Collection> mAllMarkers = new HashMap<Marker, Collection>();

@Deprecated
public MarkerManager(MapboxMap map) {
this.mMap = map;
}

@Deprecated
public Collection newCollection() {
return new Collection();
}
Expand All @@ -42,7 +46,9 @@ public Collection newCollection() {
* Create a new named collection, which can later be looked up by {@link #getCollection(String)}
*
* @param id a unique id for this collection.
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public Collection newCollection(String id) {
if (mNamedCollections.get(id) != null) {
throw new IllegalArgumentException("collection id is not unique: " + id);
Expand All @@ -56,11 +62,14 @@ public Collection newCollection(String id) {
* Gets a named collection that was created by {@link #newCollection(String)}
*
* @param id the unique id for this collection.
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public Collection getCollection(String id) {
return mNamedCollections.get(id);
}

@Deprecated
@Override
public View getInfoWindow(Marker marker) {
Collection collection = mAllMarkers.get(marker);
Expand All @@ -70,6 +79,7 @@ public View getInfoWindow(Marker marker) {
return null;
}

@Deprecated
@Override
public boolean onInfoWindowClick(Marker marker) {
Collection collection = mAllMarkers.get(marker);
Expand All @@ -79,6 +89,7 @@ public boolean onInfoWindowClick(Marker marker) {
return true;
}

@Deprecated
@Override
public boolean onMarkerClick(Marker marker) {
Collection collection = mAllMarkers.get(marker);
Expand All @@ -93,29 +104,35 @@ public boolean onMarkerClick(Marker marker) {
*
* @param marker the marker to remove.
* @return true if the marker was removed.
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public boolean remove(Marker marker) {
Collection collection = mAllMarkers.get(marker);
return collection != null && collection.remove(marker);
}

@Deprecated
public class Collection {
private final Set<Marker> mMarkers = new HashSet<Marker>();
private MapboxMap.OnInfoWindowClickListener mInfoWindowClickListener;
private MapboxMap.OnMarkerClickListener mMarkerClickListener;
// private MapboxMap.OnMarkerDragListener mMarkerDragListener;
private MapboxMap.InfoWindowAdapter mInfoWindowAdapter;

@Deprecated
public Collection() {
}

@Deprecated
public Marker addMarker(MarkerOptions opts) {
Marker marker = mMap.addMarker(opts);
mMarkers.add(marker);
mAllMarkers.put(marker, Collection.this);
return marker;
}

@Deprecated
public boolean remove(Marker marker) {
if (mMarkers.remove(marker)) {
mAllMarkers.remove(marker);
Expand All @@ -125,6 +142,7 @@ public boolean remove(Marker marker) {
return false;
}

@Deprecated
public void clear() {
for (Marker marker : mMarkers) {
marker.remove();
Expand All @@ -133,18 +151,22 @@ public void clear() {
mMarkers.clear();
}

@Deprecated
public java.util.Collection<Marker> getMarkers() {
return Collections.unmodifiableCollection(mMarkers);
}

@Deprecated
public void setOnInfoWindowClickListener(MapboxMap.OnInfoWindowClickListener infoWindowClickListener) {
mInfoWindowClickListener = infoWindowClickListener;
}

@Deprecated
public void setOnMarkerClickListener(MapboxMap.OnMarkerClickListener markerClickListener) {
mMarkerClickListener = markerClickListener;
}

@Deprecated
public void setOnInfoWindowAdapter(MapboxMap.InfoWindowAdapter infoWindowAdapter) {
mInfoWindowAdapter = infoWindowAdapter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
* <p>
* Inspired by https://github.com/googlemaps/android-maps-utils.
* </p>
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface Cluster<T extends ClusterItem> {
public LatLng getPosition();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* <p>
* Inspired by https://github.com/googlemaps/android-maps-utils.
* </p>
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface ClusterItem {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
* for clustering functionality at the core level,
* please follow the work on https://github.com/mapbox/mapbox-gl-native/issues/5814
* </p>
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public class ClusterManagerPlugin<T extends ClusterItem> implements
MapboxMap.OnCameraIdleListener,
MapboxMap.OnMarkerClickListener,
Expand All @@ -56,10 +59,12 @@ public class ClusterManagerPlugin<T extends ClusterItem> implements
private OnClusterItemInfoWindowClickListener<T> mOnClusterItemInfoWindowClickListener;
private OnClusterClickListener<T> mOnClusterClickListener;

@Deprecated
public ClusterManagerPlugin(Context context, MapboxMap map) {
this(context, map, new MarkerManager(map));
}

@Deprecated
public ClusterManagerPlugin(Context context, MapboxMap map, MarkerManager markerManager) {
mMap = map;
mMarkerManager = markerManager;
Expand All @@ -71,18 +76,22 @@ public ClusterManagerPlugin(Context context, MapboxMap map, MarkerManager marker
mRenderer.onAdd();
}

@Deprecated
public MarkerManager.Collection getMarkerCollection() {
return mMarkers;
}

@Deprecated
public MarkerManager.Collection getClusterMarkerCollection() {
return mClusterMarkers;
}

@Deprecated
public MarkerManager getMarkerManager() {
return mMarkerManager;
}

@Deprecated
public void setRenderer(ClusterRenderer<T> view) {
mRenderer.setOnClusterClickListener(null);
mRenderer.setOnClusterItemClickListener(null);
Expand All @@ -98,6 +107,7 @@ public void setRenderer(ClusterRenderer<T> view) {
cluster();
}

@Deprecated
public void setAlgorithm(Algorithm<T> algorithm) {
mAlgorithmLock.writeLock().lock();
try {
Expand All @@ -111,18 +121,22 @@ public void setAlgorithm(Algorithm<T> algorithm) {
cluster();
}

@Deprecated
public void setAnimation(boolean animate) {
mRenderer.setAnimation(animate);
}

@Deprecated
public ClusterRenderer<T> getRenderer() {
return mRenderer;
}

@Deprecated
public Algorithm<T> getAlgorithm() {
return mAlgorithm;
}

@Deprecated
public void clearItems() {
mAlgorithmLock.writeLock().lock();
try {
Expand All @@ -132,6 +146,7 @@ public void clearItems() {
}
}

@Deprecated
public void addItems(Collection<T> items) {
mAlgorithmLock.writeLock().lock();
try {
Expand All @@ -142,6 +157,7 @@ public void addItems(Collection<T> items) {

}

@Deprecated
public void addItem(T myItem) {
mAlgorithmLock.writeLock().lock();
try {
Expand All @@ -151,6 +167,7 @@ public void addItem(T myItem) {
}
}

@Deprecated
public void removeItem(T item) {
mAlgorithmLock.writeLock().lock();
try {
Expand All @@ -162,7 +179,10 @@ public void removeItem(T item) {

/**
* Force a re-cluster. You may want to call this after adding new item(s).
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public void cluster() {
mClusterTaskLock.writeLock().lock();
try {
Expand All @@ -181,7 +201,10 @@ public void cluster() {

/**
* Might re-cluster.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
@Override
public void onCameraIdle() {
Timber.d("OnCamerIdle");
Expand All @@ -199,12 +222,14 @@ public void onCameraIdle() {
cluster();
}

@Deprecated
@Override
public boolean onInfoWindowClick(@NonNull Marker marker) {
getMarkerManager().onInfoWindowClick(marker);
return true;
}

@Deprecated
@Override
public boolean onMarkerClick(Marker marker) {
return getMarkerManager().onMarkerClick(marker);
Expand Down Expand Up @@ -233,7 +258,10 @@ protected void onPostExecute(Set<? extends Cluster<T>> clusters) {
/**
* Sets a callback that's invoked when a Cluster is tapped. Note: For this listener to function,
* the ClusterManagerPlugin must be added as a click listener to the map.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public void setOnClusterClickListener(OnClusterClickListener<T> listener) {
mOnClusterClickListener = listener;
mRenderer.setOnClusterClickListener(listener);
Expand All @@ -242,7 +270,10 @@ public void setOnClusterClickListener(OnClusterClickListener<T> listener) {
/**
* Sets a callback that's invoked when a Cluster is tapped. Note: For this listener to function,
* the ClusterManagerPlugin must be added as a info window click listener to the map.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public void setOnClusterInfoWindowClickListener(OnClusterInfoWindowClickListener<T> listener) {
mOnClusterInfoWindowClickListener = listener;
mRenderer.setOnClusterInfoWindowClickListener(listener);
Expand All @@ -251,7 +282,10 @@ public void setOnClusterInfoWindowClickListener(OnClusterInfoWindowClickListener
/**
* Sets a callback that's invoked when an individual ClusterItem is tapped. Note: For this
* listener to function, the ClusterManagerPlugin must be added as a click listener to the map.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public void setOnClusterItemClickListener(OnClusterItemClickListener<T> listener) {
mOnClusterItemClickListener = listener;
mRenderer.setOnClusterItemClickListener(listener);
Expand All @@ -260,36 +294,51 @@ public void setOnClusterItemClickListener(OnClusterItemClickListener<T> listener
/**
* Sets a callback that's invoked when an individual ClusterItem's Info Window is tapped. Note: For this
* listener to function, the ClusterManagerPlugin must be added as a info window click listener to the map.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public void setOnClusterItemInfoWindowClickListener(OnClusterItemInfoWindowClickListener<T> listener) {
mOnClusterItemInfoWindowClickListener = listener;
mRenderer.setOnClusterItemInfoWindowClickListener(listener);
}

/**
* Called when a Cluster is clicked.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface OnClusterClickListener<T extends ClusterItem> {
public boolean onClusterClick(Cluster<T> cluster);
}

/**
* Called when a Cluster's Info Window is clicked.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface OnClusterInfoWindowClickListener<T extends ClusterItem> {
public void onClusterInfoWindowClick(Cluster<T> cluster);
}

/**
* Called when an individual ClusterItem is clicked.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface OnClusterItemClickListener<T extends ClusterItem> {
public boolean onClusterItemClick(T item);
}

/**
* Called when an individual ClusterItem's Info Window is clicked.
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface OnClusterItemInfoWindowClickListener<T extends ClusterItem> {
public void onClusterItemInfoWindowClick(T item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
* <p>
* Inspired by https://github.com/googlemaps/android-maps-utils.
* </p>
*
* @deprecated use runtime styling to cluster markers instead
*/
@Deprecated
public interface Algorithm<T extends ClusterItem> {
void addItem(T item);

Expand Down
Loading