summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-09-19 16:30:32 +0200
committerTobrun <tobrun@mapbox.com>2018-11-14 16:25:35 +0100
commit1ceea72e6da786537cf3f4038ce56b602c12bfa8 (patch)
tree246716187421b1cc1b915440bfd6ead2c05d18ad
parent6ea511b65bc2aaf265684b01d91ea16692a95f7f (diff)
downloadqtlocation-mapboxgl-1ceea72e6da786537cf3f4038ce56b602c12bfa8.tar.gz
[android] - remove MarkerView API
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java285
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java17
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java7
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java9
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java419
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java687
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java170
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java102
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java14
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java14
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java256
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java100
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java13
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java24
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java10
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml7
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java219
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java14
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java79
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml22
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java107
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java490
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java111
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java10
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerView.java24
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java99
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java11
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java79
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java91
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml20
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view.xml27
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view_in_rect.xml20
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml2
36 files changed, 48 insertions, 3533 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java
deleted file mode 100644
index 3fd2fa4ebf..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerViewOptions.java
+++ /dev/null
@@ -1,285 +0,0 @@
-package com.mapbox.mapboxsdk.annotations;
-
-import android.os.Parcelable;
-import android.support.annotation.FloatRange;
-import android.support.annotation.NonNull;
-
-import com.mapbox.mapboxsdk.geometry.LatLng;
-
-/**
- * Abstract builder class for composing custom MarkerView objects.
- * <p>
- * Extending this class requires implementing Parceable interface.
- * </p>
- *
- * @param <U> Type of the marker view to be composed.
- * @param <T> Type of the builder to be used for composing.
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
-@Deprecated
-public abstract class BaseMarkerViewOptions<U extends MarkerView, T extends BaseMarkerViewOptions<U, T>>
- implements Parcelable {
-
- protected LatLng position;
- protected String snippet;
- protected String title;
- protected Icon icon;
- protected boolean flat;
- protected float anchorU = 0.5f;
- protected float anchorV = 1f;
- protected float infoWindowAnchorU = 0.5f;
- protected float infoWindowAnchorV = 0.0f;
- protected float rotation;
- protected boolean visible = true;
- protected boolean selected;
- protected float alpha = 1.0f;
-
- /**
- * Default constructor
- */
- public BaseMarkerViewOptions() {
- }
-
- /**
- * Set the geographical location of the MarkerView.
- *
- * @param position the location to position the {@link MarkerView}.
- * @return the object for which the method was called.
- */
- public T position(@NonNull LatLng position) {
- this.position = position;
- return getThis();
- }
-
- /**
- * Set the snippet of the MarkerView.
- *
- * @param snippet the snippet of the {@link MarkerView}.
- * @return the object for which the method was called.
- */
- public T snippet(String snippet) {
- this.snippet = snippet;
- return getThis();
- }
-
- /**
- * Set the title of the MarkerView.
- *
- * @param title the title of the {@link MarkerView}.
- * @return the object for which the method was called.
- */
- public T title(String title) {
- this.title = title;
- return getThis();
- }
-
- /**
- * Set the icon of the MarkerView.
- *
- * @param icon the icon of the {@link MarkerView}.
- * @return the object for which the method was called.
- */
- public T icon(Icon icon) {
- this.icon = icon;
- return getThis();
- }
-
- /**
- * Set the flat state of the MarkerView.
- *
- * @param flat the flat state of the {@link MarkerView}.
- * @return the object for which the method was called.
- */
- public T flat(boolean flat) {
- this.flat = flat;
- return getThis();
- }
-
- /**
- * Set the anchor of the {@link MarkerView}.
- *
- * @param u the u-value.
- * @param v the v-value.
- * @return the object for which the method was called.
- */
- public T anchor(@FloatRange(from = 0.0, to = 1.0) float u, @FloatRange(from = 0.0, to = 1.0) float v) {
- this.anchorU = u;
- this.anchorV = v;
- return getThis();
- }
-
- /**
- * Set the InfoWindow anchor of the {@link MarkerView}.
- *
- * @param u the u-value.
- * @param v the v-values.
- * @return the object for which the method was called.
- */
- public T infoWindowAnchor(@FloatRange(from = 0.0, to = 1.0) float u, @FloatRange(from = 0.0, to = 1.0) float v) {
- this.infoWindowAnchorU = u;
- this.infoWindowAnchorV = v;
- return getThis();
- }
-
- /**
- * Set the rotation of the {@link MarkerView}.
- *
- * @param rotation the rotation value.
- * @return the object for which the method was called.
- */
- public T rotation(float rotation) {
- this.rotation = rotation;
- while (this.rotation > 360) {
- this.rotation -= 360;
- }
- while (this.rotation < 0) {
- this.rotation += 360;
- }
- return getThis();
- }
-
- /**
- * Set the visibility state of the {@link MarkerView}.
- *
- * @param visible the visible state.
- * @return the object for which the method was called.
- */
- public T visible(boolean visible) {
- this.visible = visible;
- return getThis();
- }
-
- /**
- * Set the alpha of the {@link MarkerView}.
- *
- * @param alpha the alpha value.
- * @return the object for which the method was called.
- */
- public T alpha(float alpha) {
- this.alpha = alpha;
- return getThis();
- }
-
- /**
- * Get the geographical location of the {@link MarkerView}.
- *
- * @return the geographical location.
- */
- public LatLng getPosition() {
- return position;
- }
-
- /**
- * Get the snippet of the {@link MarkerView}.
- *
- * @return the snippet.
- */
- public String getSnippet() {
- return snippet;
- }
-
- /**
- * Get the title of the {@link MarkerView}.
- *
- * @return the title.
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * Get the icon of the {@link MarkerView}.
- *
- * @return the icon.
- */
- public Icon getIcon() {
- return icon;
- }
-
- /**
- * Get the flat state of the {@link MarkerView}.
- *
- * @return the flat state.
- */
- public boolean isFlat() {
- return flat;
- }
-
- /**
- * Get the u-value of the {@link MarkerView} anchor.
- *
- * @return the u-value.
- */
- public float getAnchorU() {
- return anchorU;
- }
-
- /**
- * Get the v-value of the {@link MarkerView} anchor.
- *
- * @return the v-value.
- */
- public float getAnchorV() {
- return anchorV;
- }
-
- /**
- * Get the u-value of the MarkerView InfoWindow anchor.
- *
- * @return the u-value.
- */
- public float getInfoWindowAnchorU() {
- return infoWindowAnchorU;
- }
-
- /**
- * Get the v-value of the MarkerView InfoWindow anchor.
- *
- * @return the v-value.
- */
- public float getInfoWindowAnchorV() {
- return infoWindowAnchorV;
- }
-
- /**
- * Get the rotation of the MarkerView.
- *
- * @return the rotation value.
- */
- public float getRotation() {
- return rotation;
- }
-
- /**
- * Get the visibility state of the MarkerView.
- *
- * @return the visibility state.
- */
- public boolean isVisible() {
- return visible;
- }
-
- /**
- * Get the alpha of the MarkerView.
- *
- * @return the alpha value.
- */
- public float getAlpha() {
- return alpha;
- }
-
- /**
- * Get the instance of the object for which this method was called.
- *
- * @return the object for which the this method was called.
- */
- public abstract T getThis();
-
- /**
- * Get the MarkerView.
- *
- * @return the MarkerView created from this builder.
- */
- public abstract U getMarker();
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java
index 61d4a877c2..b038f01c23 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java
@@ -25,7 +25,7 @@ import java.io.InputStream;
/**
* Factory for creating Icons from bitmap images.
* <p>
- * icon is used to display bitmaps on top of the map using {@link Marker} and {@link MarkerView}.
+ * icon is used to display bitmaps on top of the map using {@link Marker}.
* </p>
*
* @see Icon
@@ -33,14 +33,11 @@ import java.io.InputStream;
public final class IconFactory {
private static final String ICON_ID_PREFIX = "com.mapbox.icons.icon_";
- public static final Bitmap ICON_MARKERVIEW_BITMAP = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8);
- public static final String ICON_MARKERVIEW_ID = ICON_ID_PREFIX + "marker_view";
private Context context;
@SuppressLint("StaticFieldLeak")
private static IconFactory instance;
private Icon defaultMarker;
- private Icon defaultMarkerView;
private BitmapFactory.Options options;
private int nextId = 0;
@@ -121,18 +118,6 @@ public final class IconFactory {
return defaultMarker;
}
- /**
- * Provides an icon using the default marker icon used for {@link MarkerView}.
- *
- * @return An icon with the default {@link MarkerView} icon.
- */
- public Icon defaultMarkerView() {
- if (defaultMarkerView == null) {
- defaultMarkerView = fromResource(R.drawable.mapbox_markerview_icon_default);
- }
- return defaultMarkerView;
- }
-
private Icon fromInputStream(@NonNull InputStream is) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);
return fromBitmap(bitmap);
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java
index 66cd934d8d..e6c99a14c4 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java
@@ -21,15 +21,14 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
import java.lang.ref.WeakReference;
/**
- * {@code InfoWindow} is a tooltip shown when a {@link Marker} or {@link MarkerView} is tapped. Only
+ * {@code InfoWindow} is a tooltip shown when a {@link Marker} is tapped. Only
* one info window is displayed at a time. When the user clicks on a marker, the currently open info
* window will be closed and the new info window will be displayed. If the user clicks the same
* marker while its info window is currently open, the info window will be closed.
* <p>
* The info window is drawn oriented against the device's screen, centered above its associated
- * marker by default. The info window anchoring can be adjusted using
- * {@link MarkerView#setInfoWindowAnchor(float, float)} for {@link MarkerView}. The default info
- * window contains the title in bold and snippet text below the title. While either the title and
+ * marker by default. The default info window contains the title in bold and snippet text below the title.
+ * While either the title and
* snippet are optional, at least one is required to open the info window.
* </p>
*/
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java
index a99a7d08da..4ff56e1165 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Marker.java
@@ -17,10 +17,6 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
* {@link LatLng} and using {@link MapboxMap#addMarker(MarkerOptions)}. The marker icon will be
* centered at this position so it is common to add padding to the icon image before usage.
* <p>
- * If more customization is needed, we offer {@link MarkerView} which places a {@link View} on top
- * of the map at a geographical location.
- * </p>
- * <p>
* Markers are designed to be interactive. They receive click events by default, and are often used
* with event listeners to bring up info windows. An {@link InfoWindow} is displayed by default when
* either a title or snippet is provided.
@@ -62,11 +58,6 @@ public class Marker extends Annotation {
this(baseMarkerOptions.position, baseMarkerOptions.icon, baseMarkerOptions.title, baseMarkerOptions.snippet);
}
- Marker(BaseMarkerViewOptions baseMarkerViewOptions) {
- this(baseMarkerViewOptions.position, baseMarkerViewOptions.icon,
- baseMarkerViewOptions.title, baseMarkerViewOptions.snippet);
- }
-
Marker(LatLng position, Icon icon, String title, String snippet) {
this.position = position;
this.title = title;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java
deleted file mode 100644
index 9021ffbab4..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerView.java
+++ /dev/null
@@ -1,419 +0,0 @@
-package com.mapbox.mapboxsdk.annotations;
-
-import android.support.annotation.FloatRange;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.mapbox.mapboxsdk.Mapbox;
-import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-
-/**
- * MarkerView is an annotation that shows a {@link android.view.View} at a geographical location. The
- * default marker uses a provided icon. This icon can be customized using {@link IconFactory} to
- * generate an {@link Icon} using a provided image. MarkerViews are added to the map by first giving
- * a {@link LatLng} and using {@link MapboxMap#addMarker(BaseMarkerViewOptions)}. The marker view icon
- * by default is anchored at the center bottom.
- * <p>
- * If many markers are needed to be displayed on the map at once we suggest using {@link Marker}
- * instead. This class uses {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter} to adapt a
- * MarkerView model to an Android SDK {@link android.view.View} object.
- * </p>
- * <p>
- * MarkerViews are designed to be interactive. They receive click events by default, and are often
- * used with event listeners to bring up info windows. An {@link InfoWindow} is displayed by default
- * when either a title or snippet is provided.
- * </p>
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
-@Deprecated
-public class MarkerView extends Marker {
-
- private MarkerViewManager markerViewManager;
-
- private float width;
- private float height;
-
- private float anchorU;
- private float anchorV;
-
- private float offsetX = MapboxConstants.UNMEASURED;
- private float offsetY = MapboxConstants.UNMEASURED;
-
- private float infoWindowAnchorU;
- private float infoWindowAnchorV;
-
- private boolean flat;
- private boolean visible = true;
-
- private float tiltValue;
- private float rotation;
- private float alpha = 1;
-
- private Icon markerViewIcon;
-
- private boolean selected;
-
-
- /**
- * Publicly hidden default constructor
- */
- MarkerView() {
- }
-
- /**
- * Creates a instance of MarkerView using the builder of MarkerView
- *
- * @param baseMarkerViewOptions the builder used to construct the MarkerView
- */
- public MarkerView(@NonNull BaseMarkerViewOptions baseMarkerViewOptions) {
- super(baseMarkerViewOptions);
- this.alpha = baseMarkerViewOptions.getAlpha();
- this.anchorU = baseMarkerViewOptions.getAnchorU();
- this.anchorV = baseMarkerViewOptions.getAnchorV();
- this.infoWindowAnchorU = baseMarkerViewOptions.getInfoWindowAnchorU();
- this.infoWindowAnchorV = baseMarkerViewOptions.getInfoWindowAnchorV();
- this.flat = baseMarkerViewOptions.isFlat();
- this.rotation = baseMarkerViewOptions.getRotation();
- this.selected = baseMarkerViewOptions.selected;
- }
-
- float getWidth() {
- return width;
- }
-
- void setWidth(float width) {
- this.width = width;
- }
-
- float getHeight() {
- return height;
- }
-
- void setHeight(float height) {
- this.height = height;
- }
-
- /**
- * Specifies the anchor being set on a particular point of the MarkerView.
- * <p>
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0)
- * is the top-left corner of the image, and (1, 1) is the bottom-right corner.
- * </p>
- *
- * @param u u-coordinate of the anchor, as a ratio of the image width (in the range [0, 1]).
- * @param v v-coordinate of the anchor, as a ratio of the image height (in the range [0, 1]).
- */
- public void setAnchor(@FloatRange(from = 0.0, to = 1.0) float u, @FloatRange(from = 0.0, to = 1.0) float v) {
- this.anchorU = u;
- this.anchorV = v;
- setOffset(-1, -1);
- }
-
- /**
- * Get the horizontal distance, normalized to [0, 1], of the anchor from the left edge.
- *
- * @return The u-value of the anchor.
- */
- public float getAnchorU() {
- return anchorU;
- }
-
- /**
- * Get the vertical distance, normalized to [0, 1], of the anchor from the top edge.
- *
- * @return the v-value of the anchor.
- */
- public float getAnchorV() {
- return anchorV;
- }
-
- /**
- * Internal method to set the calculated offset.
- * <p>
- * These are calculated based on the View bounds and the provided anchor.
- * </p>
- *
- * @param x the x-value of the offset.
- * @param y the y-value of the offset.
- */
- void setOffset(float x, float y) {
- offsetX = x;
- offsetY = y;
- }
-
- /**
- * Internal method to get the horizontal calculated offset.
- *
- * @return the calculated horizontal offset.
- */
- float getOffsetX() {
- return offsetX;
- }
-
- /**
- * Internal method to get the vertical calculated offset.
- *
- * @return the calculated vertical offset.
- */
- float getOffsetY() {
- return offsetY;
- }
-
- /**
- * Specifies the anchor point of the info window on the View of the MarkerView.
- * <p>
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0)
- * is the top-left corner of the image, and (1, 1) is the bottom-right corner.
- * </p>
- * <p>
- * The default is the top middle of the View.
- * </p>
- *
- * @param u u-coordinate of the info window anchor, as a ratio of the image width (in the range [0, 1]).
- * @param v v-coordinate of the info window anchor, as a ratio of the image height (in the range [0, 1]).
- * @see #setAnchor(float, float) for more details.
- */
- public void setInfoWindowAnchor(@FloatRange(from = 0.0, to = 1.0) float u,
- @FloatRange(from = 0.0, to = 1.0) float v) {
- this.infoWindowAnchorU = u;
- this.infoWindowAnchorV = v;
- }
-
- /**
- * Get the horizontal distance, normalized to [0, 1], of the info window anchor from the left edge.
- *
- * @return the u value of the InfoWindow anchor.
- */
- public float getInfoWindowAnchorU() {
- return infoWindowAnchorU;
- }
-
- /**
- * Get the vertical distance, normalized to [0, 1], of the info window anchor from the top edge.
- *
- * @return the v value of the InfoWindow anchor.
- */
- public float getInfoWindowAnchorV() {
- return infoWindowAnchorV;
- }
-
- /**
- * Get the flat state of a MarkerView.
- *
- * @return true if the MarkerView is flat; false if the MarkerView is billboard.
- */
- public boolean isFlat() {
- return flat;
- }
-
- /**
- * Sets whether this MarkerView should be flat against the map (true) or a billboard facing the
- * camera (false).
- *
- * @param flat the flat state of the MarkerView.
- */
- public void setFlat(boolean flat) {
- this.flat = flat;
- }
-
- /**
- * Internal method to get the current tilted value of a MarkerView.
- *
- * @return the tilted value.
- */
- float getTilt() {
- return tiltValue;
- }
-
- /**
- * Internal method to set the current titled value of a MarkerView.
- *
- * @param tiltValue the tilted value to set.
- */
- void setTilt(@FloatRange(from = 0.0, to = MapboxConstants.MAXIMUM_TILT) float tiltValue) {
- this.tiltValue = tiltValue;
- }
-
- /**
- * Set the visible state of a MarkerView.
- *
- * @param visible true will make the MarkerView visible, false will hide the MarkerView.
- */
- public void setVisible(boolean visible) {
- this.visible = visible;
- if (markerViewManager != null) {
- markerViewManager.animateVisible(this, visible);
- }
- }
-
- /**
- * Returns the visible state of the MarkerView.
- *
- * @return the visible state.
- */
- public boolean isVisible() {
- return visible;
- }
-
- /**
- * Set the rotation value of the MarkerView in degrees.
- * <p>
- * Input will be limited to 0 - 360 degrees.
- * </p>
- * <p>
- * This will result in animating the rotation of the MarkerView using an rotation animator
- * from current value to the provided parameter value.
- * </p>
- *
- * @param rotation the rotation value to animate to.
- */
- public void setRotation(float rotation) {
- this.rotation = rotation;
- if (markerViewManager != null) {
- markerViewManager.setRotation(this, rotation);
- }
- }
-
- /**
- * Get the rotation value of the MarkerView.
- *
- * @return the rotation value.
- */
- public float getRotation() {
- return rotation;
- }
-
- /**
- * Get the alpha value of the MarkerView.
- *
- * @return the alpha value.
- */
- public float getAlpha() {
- return alpha;
- }
-
- /**
- * Set the alpha value of the MarkerView.
- * <p>
- * This will result in animating the alpha of the MarkerView using an alpha animator
- * from current value to the provided parameter value.
- * </p>
- *
- * @param alpha the alpha value to animate to.
- */
- public void setAlpha(@FloatRange(from = 0.0, to = 255.0) float alpha) {
- this.alpha = alpha;
- if (markerViewManager != null) {
- markerViewManager.animateAlpha(this, alpha);
- }
- }
-
- /**
- * Set the icon of the MarkerView.
- *
- * @param icon the {@link Icon} to be used as Marker image.
- */
- @Override
- public void setIcon(@Nullable Icon icon) {
- if (icon != null) {
- markerViewIcon = IconFactory.recreate(IconFactory.ICON_MARKERVIEW_ID, icon.getBitmap());
- }
- Icon transparentIcon = IconFactory.recreate(IconFactory.ICON_MARKERVIEW_ID,
- IconFactory.ICON_MARKERVIEW_BITMAP);
- if (markerViewManager != null) {
- markerViewManager.updateIcon(this);
- }
- super.setIcon(transparentIcon);
- }
-
- /**
- * Sets the location of the marker.
- *
- * @param position A {@link LatLng} defining the marker position.
- */
- @Override
- public void setPosition(LatLng position) {
- super.setPosition(position);
- if (markerViewManager != null) {
- markerViewManager.setWaitingForRenderInvoke(true);
- markerViewManager.update();
- }
- }
-
- /**
- * Determine if the {@link MarkerView} is selected or not.
- *
- * @return True if the MarkerView's selected, else false.
- */
- public boolean isSelected() {
- return selected;
- }
-
- /**
- * For internal use only, use {@link MapboxMap#selectMarker(Marker)} instead.
- */
- void setSelected(boolean selected) {
- this.selected = selected;
- }
-
- /**
- * Get the icon of the MarkerView.
- *
- * @return the icon use as Marker image.
- */
- @Override
- public Icon getIcon() {
- if (markerViewIcon == null) {
- setIcon(IconFactory.getInstance(Mapbox.getApplicationContext()).defaultMarkerView());
- }
- return markerViewIcon;
- }
-
- /**
- * Set the MapboxMap associated tot the MapView containing the MarkerView.
- * <p>
- * This method is used to instantiate the MarkerView and provide an instance of
- * {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter}
- * </p>
- * <p>
- * This method is used to notify that a MarkerView is no longer active by setting a null value.
- * </p>
- *
- * @param mapboxMap the MapboxMap instances.
- */
- @Override
- public void setMapboxMap(@Nullable MapboxMap mapboxMap) {
- super.setMapboxMap(mapboxMap);
- if (mapboxMap != null) {
- if (isFlat()) {
- // initial tilt value if MapboxMap is started with a tilt attribute
- tiltValue = (float) mapboxMap.getCameraPosition().tilt;
- }
-
- markerViewManager = mapboxMap.getMarkerViewManager();
- }
- }
-
- /**
- * Invalidates the MarkerView resulting in remeasuring the View.
- */
- void invalidate() {
- width = height = 0;
- offsetX = offsetY = MapboxConstants.UNMEASURED;
- markerViewManager.invalidateViewMarkersInVisibleRegion();
- }
-
- /**
- * Get the String representation of a MarkerView.
- *
- * @return the String representation.
- */
- @NonNull
- @Override
- public String toString() {
- return "MarkerView [position[" + getPosition() + "]]";
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java
deleted file mode 100644
index cd32fac942..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java
+++ /dev/null
@@ -1,687 +0,0 @@
-package com.mapbox.mapboxsdk.annotations;
-
-import android.content.Context;
-import android.graphics.PointF;
-import android.graphics.RectF;
-import android.os.SystemClock;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.util.LongSparseArray;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.widget.ImageView;
-
-import com.mapbox.mapboxsdk.R;
-import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.utils.AnimatorUtils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Interface for interacting with ViewMarkers objects inside of a MapView.
- * <p>
- * This class is responsible for managing a {@link MarkerView} item.
- * </p>
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
-@Deprecated
-public class MarkerViewManager implements MapView.OnDidFinishRenderingFrameListener {
-
- @NonNull
- private final ViewGroup markerViewContainer;
- private final ViewTreeObserver.OnPreDrawListener markerViewPreDrawObserver =
- new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- invalidateViewMarkersInVisibleRegion();
- markerViewContainer.getViewTreeObserver().removeOnPreDrawListener(markerViewPreDrawObserver);
- return false;
- }
- };
- private final Map<MarkerView, View> markerViewMap = new HashMap<>();
- private final LongSparseArray<OnMarkerViewAddedListener> markerViewAddedListenerMap = new LongSparseArray<>();
- private final List<MapboxMap.MarkerViewAdapter> markerViewAdapters = new ArrayList<>();
-
- // TODO refactor MapboxMap out for Projection and Transform
- // Requires removing MapboxMap from Annotations by using Peer model from #6912
- private MapboxMap mapboxMap;
-
- private boolean enabled;
- private long updateTime;
- @Nullable
- private MapboxMap.OnMarkerViewClickListener onMarkerViewClickListener;
- private boolean isWaitingForRenderInvoke;
-
- /**
- * Creates an instance of MarkerViewManager.
- *
- * @param container the ViewGroup associated with the MarkerViewManager
- */
- public MarkerViewManager(@NonNull ViewGroup container) {
- this.markerViewContainer = container;
- this.markerViewAdapters.add(new ImageMarkerViewAdapter(container.getContext()));
- }
-
- // TODO refactor MapboxMap out for Projection and Transform
- // Requires removing MapboxMap from Annotations by using Peer model from #6912
- public void bind(MapboxMap mapboxMap) {
- this.mapboxMap = mapboxMap;
- }
-
- @Override
- public void onDidFinishRenderingFrame(boolean fully) {
- if (isWaitingForRenderInvoke && fully) {
- isWaitingForRenderInvoke = false;
- invalidateViewMarkersInVisibleRegion();
- }
- }
-
- /**
- * Called to enable or disable MarkerView management.
- *
- * @param enabled true if management should be enabled
- */
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * Called with true to wait for the next render invocation.
- *
- * @param waitingForRenderInvoke true if waiting for next render event
- */
- public void setWaitingForRenderInvoke(boolean waitingForRenderInvoke) {
- isWaitingForRenderInvoke = waitingForRenderInvoke;
- }
-
- /**
- * Animate a MarkerView to a given rotation.
- * <p>
- * The {@link MarkerView} will be rotated from its current rotation to the given rotation.
- * </p>
- *
- * @param marker the MarkerView to rotate.
- * @param rotation the rotation value.
- */
- public void animateRotation(@NonNull MarkerView marker, float rotation) {
- View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- AnimatorUtils.rotate(convertView, rotation);
- }
- }
-
- /**
- * Animate a MarkerView with a given rotation.
- *
- * @param marker the MarkerView to rotate by.
- * @param rotation the rotation by value, limited to 0 - 360 degrees.
- */
- public void animateRotationBy(@NonNull MarkerView marker, float rotation) {
- View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- convertView.animate().cancel();
- // calculate new direction
- float diff = rotation - convertView.getRotation();
- if (diff > 180.0f) {
- diff -= 360.0f;
- } else if (diff < -180.0f) {
- diff += 360.f;
- }
- AnimatorUtils.rotateBy(convertView, diff);
- }
- }
-
- /**
- * Set the rotation of a MarkerView to a given rotation value.
- *
- * @param marker The MarkerView to change its rotation value
- * @param rotation The rotation value
- */
- public void setRotation(@NonNull MarkerView marker, float rotation) {
- View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- convertView.animate().cancel();
- convertView.setRotation(rotation);
- }
- }
-
- /**
- * Animate a MarkerView to a given alpha value.
- * <p>
- * The {@link MarkerView} will be transformed from its current alpha value to the given value.
- * </p>
- *
- * @param marker the MarkerView to change its alpha value.
- * @param alpha the alpha value.
- */
- public void animateAlpha(@NonNull MarkerView marker, float alpha) {
- View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- AnimatorUtils.alpha(convertView, alpha);
- }
- }
-
- /**
- * Animate a MarkerVIew to be visible or invisible
- * <p>
- * The {@link MarkerView} will be made {@link View#VISIBLE} or {@link View#GONE}.
- * </p>
- *
- * @param marker the MarkerView to change its visibility
- * @param visible the flag indicating if MarkerView is visible
- */
- public void animateVisible(@NonNull MarkerView marker, boolean visible) {
- View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- convertView.setVisibility(visible ? View.VISIBLE : View.GONE);
- }
- }
-
- /**
- * Updates the position of MarkerViews currently found in the viewport.
- * <p>
- * The collection of {@link MarkerView} will be iterated and each item position will be updated.
- * If an item is View state is not visible and its related flag is set to visible, the
- * {@link MarkerView} will be animated to visible using alpha animation.
- * </p>
- */
- public void updateMarkerViewsPosition() {
- for (final MarkerView marker : markerViewMap.keySet()) {
- final View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- PointF point = mapboxMap.getProjection().toScreenLocation(marker.getPosition());
- if (marker.getOffsetX() == MapboxConstants.UNMEASURED) {
- // ensure view is measured first
- // #6805 invalidate marker views to ensure convertView width and height
- // values are properly measured and up to date
- if (marker.getWidth() == 0 && marker.isVisible()) {
- convertView.getViewTreeObserver().addOnPreDrawListener(markerViewPreDrawObserver);
- }
- }
-
- marker.setWidth(convertView.getWidth());
- marker.setHeight(convertView.getHeight());
-
- if (marker.getWidth() != 0) {
- int x = (int) (marker.getAnchorU() * marker.getWidth());
- int y = (int) (marker.getAnchorV() * marker.getHeight());
- marker.setOffset(x, y);
- }
-
- convertView.setX(point.x - marker.getOffsetX());
- convertView.setY(point.y - marker.getOffsetY());
-
- // animate visibility
- if (marker.isVisible() && convertView.getVisibility() == View.GONE) {
- animateVisible(marker, true);
- }
- }
- }
- }
-
- /**
- * Set tilt on every non flat MarkerView currently shown in the Viewport.
- *
- * @param tilt the tilt value.
- */
- public void setTilt(float tilt) {
- View convertView;
- for (MarkerView markerView : markerViewMap.keySet()) {
- if (markerView.isFlat()) {
- convertView = markerViewMap.get(markerView);
- if (convertView != null) {
- markerView.setTilt(tilt);
- convertView.setRotationX(tilt);
- }
- }
- }
- }
-
- /**
- * Update and invalidate the MarkerView icon.
- *
- * @param markerView the marker view to updates.
- */
- public void updateIcon(@NonNull MarkerView markerView) {
- View convertView = markerViewMap.get(markerView);
- if (convertView != null && convertView instanceof ImageView) {
- ((ImageView) convertView).setImageBitmap(markerView.getIcon().getBitmap());
- markerView.invalidate();
- }
- }
-
- /**
- * Animate a MarkerView to a deselected state.
- * <p>
- * The {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter#onDeselect(MarkerView, View)}
- * will be called to execute an animation.
- * </p>
- *
- * @param marker the MarkerView to deselect.
- */
- public void deselect(@NonNull MarkerView marker) {
- deselect(marker, true);
- }
-
- /**
- * Animate a MarkerView to a deselected state.
- * <p>
- * The {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter#onDeselect(MarkerView, View)}
- * will be called to execute an animation.
- * </p>
- *
- * @param marker the MarkerView to deselect.
- * @param callbackToMap indicates if deselect marker must be called on MapboxMap.
- */
- public void deselect(@NonNull MarkerView marker, boolean callbackToMap) {
- final View convertView = markerViewMap.get(marker);
- if (convertView != null) {
- for (MapboxMap.MarkerViewAdapter adapter : markerViewAdapters) {
- if (adapter.getMarkerClass().equals(marker.getClass())) {
- adapter.onDeselect(marker, convertView);
- }
- }
- }
- if (callbackToMap) {
- mapboxMap.deselectMarker(marker);
- }
- marker.setSelected(false);
- }
-
- /**
- * Animate a MarkerView to a selected state.
- *
- * @param marker the MarkerView object to select.
- */
- public void select(@NonNull MarkerView marker) {
- select(marker, true);
- }
-
- /**
- * Animate a MarkerView to a selected state.
- *
- * @param marker the MarkerView object to select.
- * @param callbackToMap indicates if select marker must be called on {@link MapboxMap}.
- */
- public void select(@NonNull MarkerView marker, boolean callbackToMap) {
- final View convertView = markerViewMap.get(marker);
- for (MapboxMap.MarkerViewAdapter adapter : markerViewAdapters) {
- if (adapter.getMarkerClass().equals(marker.getClass())) {
- select(marker, convertView, adapter, callbackToMap);
- }
- }
- }
-
- /**
- * Animate a MarkerView to a selected state.
- * <p>
- * The {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter#onSelect(MarkerView, View, boolean)}
- * will be called to execute an animation.
- * </p>
- *
- * @param marker the MarkerView object to select.
- * @param convertView the View presentation of the MarkerView.
- * @param adapter the adapter used to adapt the marker to the convertView.
- */
- public void select(@NonNull MarkerView marker, View convertView, @NonNull MapboxMap.MarkerViewAdapter adapter) {
- select(marker, convertView, adapter, true);
- }
-
-
- /**
- * Animate a MarkerView to a selected state.
- * <p>
- * The {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter#onSelect(MarkerView, View, boolean)}
- * will be called to execute an animation.
- * </p>
- *
- * @param marker the MarkerView object to select.
- * @param convertView the View presentation of the MarkerView.
- * @param adapter the adapter used to adapt the marker to the convertView.
- * @param callbackToMap indicates if select marker must be called on MapboxMap.
- */
- public void select(@NonNull MarkerView marker, @Nullable View convertView,
- @NonNull MapboxMap.MarkerViewAdapter adapter, boolean callbackToMap) {
- if (convertView != null) {
- if (adapter.onSelect(marker, convertView, false)) {
- if (callbackToMap) {
- mapboxMap.selectMarker(marker);
- }
- }
- marker.setSelected(true);
- convertView.bringToFront();
- }
- }
-
- /**
- * Get view representation from a MarkerView. If marker is not found in current viewport,
- * {@code null} is returned.
- *
- * @param marker the marker to get the view.
- * @return the Android SDK View object.
- */
- @Nullable
- public View getView(MarkerView marker) {
- return markerViewMap.get(marker);
- }
-
- /**
- * Get the view adapter for a marker.
- *
- * @param markerView the marker to get the view adapter.
- * @return the MarkerView adapter.
- */
- @Nullable
- public MapboxMap.MarkerViewAdapter getViewAdapter(@NonNull MarkerView markerView) {
- MapboxMap.MarkerViewAdapter adapter = null;
- for (MapboxMap.MarkerViewAdapter a : markerViewAdapters) {
- if (a.getMarkerClass().equals(markerView.getClass())) {
- adapter = a;
- }
- }
- return adapter;
- }
-
- /**
- * Remove a MarkerView from a map.
- * <p>
- * The {@link MarkerView} will be removed using an alpha animation and related {@link View}
- * will be released to the android.support.v4.util.Pools.SimplePool from the related
- * {@link com.mapbox.mapboxsdk.maps.MapboxMap.MarkerViewAdapter}. It's possible to remove
- * the {@link MarkerView} from the underlying collection if needed.
- * </p>
- *
- * @param marker the MarkerView to remove.
- */
- public void removeMarkerView(@Nullable MarkerView marker) {
- final View viewHolder = markerViewMap.get(marker);
- if (viewHolder != null && marker != null) {
- for (final MapboxMap.MarkerViewAdapter<?> adapter : markerViewAdapters) {
- if (adapter.getMarkerClass().equals(marker.getClass())) {
- if (adapter.prepareViewForReuse(marker, viewHolder)) {
- // reset offset for reuse
- marker.setOffset(MapboxConstants.UNMEASURED, MapboxConstants.UNMEASURED);
- adapter.releaseView(viewHolder);
- }
- }
- }
- }
- marker.setMapboxMap(null);
- markerViewMap.remove(marker);
- }
-
- /**
- * Add a MarkerViewAdapter to the MarkerViewManager.
- * <p>
- * The provided MarkerViewAdapter must supply a generic subclass of MarkerView.
- * </p>
- *
- * @param markerViewAdapter the MarkerViewAdapter to add.
- */
- public void addMarkerViewAdapter(@NonNull MapboxMap.MarkerViewAdapter markerViewAdapter) {
- if (markerViewAdapter.getMarkerClass().equals(MarkerView.class)) {
- throw new RuntimeException("Providing a custom MarkerViewAdapter requires subclassing MarkerView");
- }
-
- if (!markerViewAdapters.contains(markerViewAdapter)) {
- markerViewAdapters.add(markerViewAdapter);
- invalidateViewMarkersInVisibleRegion();
- }
- }
-
- /**
- * Get all MarkerViewAdapters associated with this MarkerViewManager.
- *
- * @return a List of MarkerViewAdapters.
- */
- @NonNull
- public List<MapboxMap.MarkerViewAdapter> getMarkerViewAdapters() {
- return markerViewAdapters;
- }
-
- /**
- * Register a callback to be invoked when this view is clicked.
- *
- * @param listener the callback to be invoked.
- */
- public void setOnMarkerViewClickListener(@Nullable MapboxMap.OnMarkerViewClickListener listener) {
- onMarkerViewClickListener = listener;
- }
-
- /**
- * Schedule that ViewMarkers found in the viewport are invalidated.
- * <p>
- * This method is rate limited, and {@link #invalidateViewMarkersInVisibleRegion} will only be called
- * once each 250 ms.
- * </p>
- */
- public void update() {
- if (enabled) {
- long currentTime = SystemClock.elapsedRealtime();
- if (currentTime < updateTime) {
- updateMarkerViewsPosition();
- return;
- }
- invalidateViewMarkersInVisibleRegion();
- updateTime = currentTime + 250;
- }
- }
-
- /**
- * Invalidate the ViewMarkers found in the viewport.
- * <p>
- * This method will remove any markers that aren't in the viewport anymore and will add new
- * ones for each found Marker in the changed viewport.
- * </p>
- */
- public void invalidateViewMarkersInVisibleRegion() {
- RectF mapViewRect = new RectF(0, 0, markerViewContainer.getWidth(), markerViewContainer.getHeight());
- List<MarkerView> markers = mapboxMap.getMarkerViewsInRect(mapViewRect);
- View convertView;
-
- // remove old markers
- Iterator<MarkerView> iterator = markerViewMap.keySet().iterator();
- while (iterator.hasNext()) {
- MarkerView marker = iterator.next();
- if (!markers.contains(marker)) {
- // remove marker
- convertView = markerViewMap.get(marker);
- for (MapboxMap.MarkerViewAdapter adapter : markerViewAdapters) {
- if (adapter.getMarkerClass().equals(marker.getClass())) {
- adapter.prepareViewForReuse(marker, convertView);
- adapter.releaseView(convertView);
- iterator.remove();
- }
- }
- }
- }
-
- // introduce new markers
- for (final MarkerView marker : markers) {
- if (!markerViewMap.containsKey(marker)) {
- for (final MapboxMap.MarkerViewAdapter adapter : markerViewAdapters) {
- if (adapter.getMarkerClass().equals(marker.getClass())) {
-
- // Inflate View
- convertView = (View) adapter.getViewReusePool().acquire();
- final View adaptedView = adapter.getView(marker, convertView, markerViewContainer);
- if (adaptedView != null) {
- adaptedView.setRotationX(marker.getTilt());
- adaptedView.setRotation(marker.getRotation());
- adaptedView.setAlpha(marker.getAlpha());
- adaptedView.setVisibility(View.GONE);
-
- if (mapboxMap.getSelectedMarkers().contains(marker)) {
- // if a marker to be shown was selected
- // replay that animation with duration 0
- if (adapter.onSelect(marker, adaptedView, true)) {
- mapboxMap.selectMarker(marker);
- }
- }
-
- marker.setMapboxMap(mapboxMap);
- markerViewMap.put(marker, adaptedView);
- if (convertView == null) {
- adaptedView.setVisibility(View.GONE);
- markerViewContainer.addView(adaptedView);
- }
- }
-
- // notify listener is marker view is rendered
- OnMarkerViewAddedListener onViewAddedListener = markerViewAddedListenerMap.get(marker.getId());
- if (onViewAddedListener != null) {
- onViewAddedListener.onViewAdded(marker);
- markerViewAddedListenerMap.remove(marker.getId());
- }
- }
- }
- }
- }
-
- // clear map, don't keep references to MarkerView listeners that are not found in the bounds of the map.
- markerViewAddedListenerMap.clear();
-
- // trigger update to make newly added ViewMarker visible,
- // these would only be updated when the map is moved.
- updateMarkerViewsPosition();
- }
-
- /**
- * When the provided MarkerView is clicked on by a user, we check if a custom click
- * event has been created and if not, display a InfoWindow.
- *
- * @param markerView that the click event occurred
- * @return true if the marker view click has been handled, false if not
- */
- public boolean onClickMarkerView(@NonNull MarkerView markerView) {
- boolean clickHandled = false;
-
- MapboxMap.MarkerViewAdapter adapter = getViewAdapter(markerView);
- View view = getView(markerView);
- if (adapter == null || view == null) {
- // not a valid state
- return true;
- }
-
- if (onMarkerViewClickListener != null) {
- clickHandled = onMarkerViewClickListener.onMarkerClick(markerView, view, adapter);
- }
-
- return clickHandled;
- }
-
- /**
- * Handles the MarkerView info window offset.
- *
- * @param marker that we are ensuring info window offset
- */
- public void ensureInfoWindowOffset(@NonNull MarkerView marker) {
- View view = null;
- if (markerViewMap.containsKey(marker)) {
- view = markerViewMap.get(marker);
- } else {
- for (final MapboxMap.MarkerViewAdapter adapter : markerViewAdapters) {
- if (adapter.getMarkerClass().equals(marker.getClass())) {
- View convertView = (View) adapter.getViewReusePool().acquire();
- view = adapter.getView(marker, convertView, markerViewContainer);
- break;
- }
- }
- }
-
- if (view != null) {
- if (marker.getWidth() == 0) {
- if (view.getMeasuredWidth() == 0) {
- // Ensure the marker's view is measured first
- view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
- }
- marker.setWidth(view.getMeasuredWidth());
- marker.setHeight(view.getMeasuredHeight());
- }
-
- // update position on map
- if (marker.getOffsetX() == MapboxConstants.UNMEASURED) {
- int x = (int) (marker.getAnchorU() * marker.getWidth());
- int y = (int) (marker.getAnchorV() * marker.getHeight());
- marker.setOffset(x, y);
- }
-
- // InfoWindow offset
- int infoWindowOffsetX = (int) ((view.getMeasuredWidth() * marker.getInfoWindowAnchorU()) - marker.getOffsetX());
- int infoWindowOffsetY = (int) ((view.getMeasuredHeight() * marker.getInfoWindowAnchorV()) - marker.getOffsetY());
- marker.setTopOffsetPixels(infoWindowOffsetY);
- marker.setRightOffsetPixels(infoWindowOffsetX);
- }
- }
-
- @NonNull
- public ViewGroup getMarkerViewContainer() {
- return markerViewContainer;
- }
-
- public void addOnMarkerViewAddedListener(@NonNull MarkerView markerView,
- OnMarkerViewAddedListener onMarkerViewAddedListener) {
- markerViewAddedListenerMap.put(markerView.getId(), onMarkerViewAddedListener);
- }
-
- /**
- * Default MarkerViewAdapter used for base class of MarkerView to adapt a MarkerView to
- * an ImageView.
- */
- private static class ImageMarkerViewAdapter extends MapboxMap.MarkerViewAdapter<MarkerView> {
-
- private LayoutInflater inflater;
-
- ImageMarkerViewAdapter(Context context) {
- super(context, MarkerView.class);
- inflater = LayoutInflater.from(context);
- }
-
- @Nullable
- @Override
- public View getView(@NonNull MarkerView marker, @Nullable View convertView, @NonNull ViewGroup parent) {
- ViewHolder viewHolder;
- if (convertView == null) {
- viewHolder = new ViewHolder();
- convertView = inflater.inflate(R.layout.mapbox_view_image_marker, parent, false);
- viewHolder.imageView = (ImageView) convertView.findViewById(R.id.image);
- convertView.setTag(viewHolder);
- } else {
- viewHolder = (ViewHolder) convertView.getTag();
- }
- viewHolder.imageView.setImageBitmap(marker.getIcon().getBitmap());
- viewHolder.imageView.setContentDescription(marker.getTitle());
- return convertView;
- }
-
- private static class ViewHolder {
- ImageView imageView;
- }
- }
-
- /**
- * Interface definition invoked when the View of a MarkerView has been added to the map.
- * <p>
- * {@link MapboxMap#addMarker(BaseMarkerOptions)}
- * and only when the related MarkerView is found in the viewport of the map.
- * </p>
- */
- public interface OnMarkerViewAddedListener {
-
- /**
- * Invoked when the View of a MarkerView has been added to the Map.
- *
- * @param markerView The MarkerView the View was added for
- */
- void onViewAdded(@NonNull MarkerView markerView);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java
deleted file mode 100644
index af56f126e3..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewOptions.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package com.mapbox.mapboxsdk.annotations;
-
-import android.graphics.Bitmap;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-
-/**
- * builder class for composing MarkerView objects.
- * <p>
- * Do not extend this class directly but extend {@link BaseMarkerViewOptions} instead.
- * </p>
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
-@Deprecated
-public class MarkerViewOptions extends BaseMarkerViewOptions<MarkerView, MarkerViewOptions> {
-
- private MarkerView marker;
-
- /**
- * Defines default options for a MarkerView. Extend {@link BaseMarkerViewOptions} if you need
- * more customization.
- */
- public MarkerViewOptions() {
- marker = new MarkerView();
- }
-
- protected MarkerViewOptions(Parcel in) {
- marker = new MarkerView();
- position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
- snippet(in.readString());
- title(in.readString());
- flat(in.readByte() != 0);
- anchor(in.readFloat(), in.readFloat());
- infoWindowAnchor(in.readFloat(), in.readFloat());
- rotation(in.readFloat());
- visible(in.readByte() != 0);
- alpha(in.readFloat());
- if (in.readByte() != 0) {
- // this means we have an icon
- String iconId = in.readString();
- Bitmap iconBitmap = in.readParcelable(Bitmap.class.getClassLoader());
- Icon icon = new Icon(iconId, iconBitmap);
- icon(icon);
- }
- }
-
- /**
- * Get the instance of the object for which this method was called.
- *
- * @return the object for which this method was called.
- */
- @NonNull
- @Override
- public MarkerViewOptions getThis() {
- return this;
- }
-
- /**
- * Describe the kinds of special objects contained in this Parcelable's
- * marshalled representation.
- *
- * @return integer 0.
- */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Flatten this object in to a Parcel.
- *
- * @param out The Parcel in which the object should be written.
- * @param flags Additional flags about how the object should be written. May be 0 or
- * {@link #PARCELABLE_WRITE_RETURN_VALUE}.
- */
- @Override
- public void writeToParcel(@NonNull Parcel out, int flags) {
- out.writeParcelable(getPosition(), flags);
- out.writeString(getSnippet());
- out.writeString(getTitle());
- out.writeByte((byte) (isFlat() ? 1 : 0));
- out.writeFloat(getAnchorU());
- out.writeFloat(getAnchorV());
- out.writeFloat(getInfoWindowAnchorU());
- out.writeFloat(getInfoWindowAnchorV());
- out.writeFloat(getRotation());
- out.writeByte((byte) (isVisible() ? 1 : 0));
- out.writeFloat(alpha);
- Icon icon = getIcon();
- out.writeByte((byte) (icon != null ? 1 : 0));
- if (icon != null) {
- out.writeString(getIcon().getId());
- out.writeParcelable(getIcon().getBitmap(), flags);
- }
- }
-
- /**
- * Get the {@link MarkerView}.
- *
- * @return {@link MarkerView}.
- */
- @Override
- public MarkerView getMarker() {
- if (position == null) {
- throw new InvalidMarkerPositionException();
- }
-
- marker.setPosition(position);
- marker.setSnippet(snippet);
- marker.setTitle(title);
- marker.setIcon(icon);
- marker.setFlat(flat);
- marker.setAnchor(anchorU, anchorV);
- marker.setInfoWindowAnchor(infoWindowAnchorU, infoWindowAnchorV);
- marker.setRotation(rotation);
- marker.setVisible(visible);
- marker.setAlpha(alpha);
- return marker;
- }
-
- public static final Parcelable.Creator<MarkerViewOptions> CREATOR =
- new Parcelable.Creator<MarkerViewOptions>() {
- public MarkerViewOptions createFromParcel(@NonNull Parcel in) {
- return new MarkerViewOptions(in);
- }
-
- public MarkerViewOptions[] newArray(int size) {
- return new MarkerViewOptions[size];
- }
- };
-
- /**
- * Compares this {@link MarkerViewOptions} object with another {@link MarkerViewOptions} and
- * determines if they match.
- *
- * @param object Another {@link MarkerViewOptions} to compare with this object.
- * @return True if the {@link MarkerViewOptions} being passed in matches this
- * {@link PolylineOptions} object. Else, false.
- */
- @Override
- public boolean equals(@Nullable Object object) {
- if (this == object) {
- return true;
- }
- if (object == null || getClass() != object.getClass()) {
- return false;
- }
- MarkerViewOptions that = (MarkerViewOptions) object;
- return marker != null ? marker.equals(that.marker) : that.marker == null;
- }
-
- /**
- * Gives an integer which can be used as the bucket number for storing elements of the set/map.
- * This bucket number is the address of the element inside the set/map. There's no guarantee
- * that this hash value will be consistent between different Java implementations, or even
- * between different execution runs of the same program.
- *
- * @return integer value you can use for storing element.
- */
- @Override
- public int hashCode() {
- return marker != null ? marker.hashCode() : 0;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
index 958ceb352c..8875e7164b 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
@@ -12,10 +12,7 @@ import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import com.mapbox.mapboxsdk.annotations.Polygon;
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
import com.mapbox.mapboxsdk.annotations.Polyline;
@@ -29,7 +26,7 @@ import java.util.List;
* Responsible for managing and tracking state of Annotations linked to Map. All events related to
* annotations that occur on {@link MapboxMap} are forwarded to this class.
* <p>
- * Responsible for referencing {@link InfoWindowManager} and {@link MarkerViewManager}.
+ * Responsible for referencing {@link InfoWindowManager}.
* </p>
* <p>
* Exposes convenience methods to add/remove/update all subtypes of annotations found in
@@ -42,11 +39,10 @@ class AnnotationManager {
private static final long NO_ANNOTATION_ID = -1;
- @Nullable
+ @NonNull
private final MapView mapView;
private final IconManager iconManager;
private final InfoWindowManager infoWindowManager = new InfoWindowManager();
- private final MarkerViewManager markerViewManager;
private final LongSparseArray<Annotation> annotationsArray;
private final List<Marker> selectedMarkers = new ArrayList<>();
@@ -64,22 +60,17 @@ class AnnotationManager {
private Polygons polygons;
private Polylines polylines;
- AnnotationManager(@Nullable MapView mapView, LongSparseArray<Annotation> annotationsArray,
- MarkerViewManager markerViewManager, IconManager iconManager, Annotations annotations,
- Markers markers, Polygons polygons, Polylines polylines, ShapeAnnotations shapeAnnotations) {
+ AnnotationManager(@NonNull MapView mapView, LongSparseArray<Annotation> annotationsArray,
+ IconManager iconManager, Annotations annotations, Markers markers, Polygons polygons,
+ Polylines polylines, ShapeAnnotations shapeAnnotations) {
this.mapView = mapView;
this.annotationsArray = annotationsArray;
- this.markerViewManager = markerViewManager;
this.iconManager = iconManager;
this.annotations = annotations;
this.markers = markers;
this.polygons = polygons;
this.polylines = polylines;
this.shapeAnnotations = shapeAnnotations;
- if (mapView != null) {
- // null checking needed for unit tests
- mapView.addOnDidFinishRenderingFrameListener(markerViewManager);
- }
}
// TODO refactor MapboxMap out for Projection and Transform
@@ -87,12 +78,10 @@ class AnnotationManager {
@NonNull
AnnotationManager bind(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
- this.markerViewManager.bind(mapboxMap);
return this;
}
void update() {
- markerViewManager.update();
infoWindowManager.update();
}
@@ -119,13 +108,8 @@ class AnnotationManager {
if (selectedMarkers.contains(marker)) {
selectedMarkers.remove(marker);
}
-
- if (marker instanceof MarkerView) {
- markerViewManager.removeMarkerView((MarkerView) marker);
- } else {
- // do icon cleanup
- iconManager.iconCleanup(marker.getIcon());
- }
+ // do icon cleanup
+ iconManager.iconCleanup(marker.getIcon());
}
annotations.removeBy(annotation);
}
@@ -138,12 +122,7 @@ class AnnotationManager {
if (selectedMarkers.contains(marker)) {
selectedMarkers.remove(marker);
}
-
- if (marker instanceof MarkerView) {
- markerViewManager.removeMarkerView((MarkerView) marker);
- } else {
- iconManager.iconCleanup(marker.getIcon());
- }
+ iconManager.iconCleanup(marker.getIcon());
}
}
annotations.removeBy(annotationList);
@@ -160,11 +139,7 @@ class AnnotationManager {
if (annotation instanceof Marker) {
Marker marker = (Marker) annotation;
marker.hideInfoWindow();
- if (marker instanceof MarkerView) {
- markerViewManager.removeMarkerView((MarkerView) marker);
- } else {
- iconManager.iconCleanup(marker.getIcon());
- }
+ iconManager.iconCleanup(marker.getIcon());
}
}
annotations.removeAll();
@@ -199,20 +174,6 @@ class AnnotationManager {
return markers.obtainAllIn(rectangle);
}
- MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions, @NonNull MapboxMap mapboxMap,
- @Nullable MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener) {
- return markers.addViewBy(markerOptions, mapboxMap, onMarkerViewAddedListener);
- }
-
- List<MarkerView> addMarkerViews(@NonNull List<? extends BaseMarkerViewOptions> markerViewOptions,
- @NonNull MapboxMap mapboxMap) {
- return markers.addViewsBy(markerViewOptions, mapboxMap);
- }
-
- List<MarkerView> getMarkerViewsInRect(@NonNull RectF rectangle) {
- return markers.obtainViewsIn(rectangle);
- }
-
void reloadMarkers() {
markers.reload();
}
@@ -288,11 +249,6 @@ class AnnotationManager {
deselectMarkers();
}
- if (marker instanceof MarkerView) {
- markerViewManager.select((MarkerView) marker, false);
- markerViewManager.ensureInfoWindowOffset((MarkerView) marker);
- }
-
if (infoWindowManager.isInfoWindowValidForMarker(marker) || infoWindowManager.getInfoWindowAdapter() != null) {
infoWindowManager.add(marker.showInfoWindow(mapboxMap, mapView));
}
@@ -311,10 +267,6 @@ class AnnotationManager {
if (marker.isInfoWindowShown()) {
marker.hideInfoWindow();
}
-
- if (marker instanceof MarkerView) {
- markerViewManager.deselect((MarkerView) marker, false);
- }
}
}
@@ -330,11 +282,6 @@ class AnnotationManager {
if (marker.isInfoWindowShown()) {
marker.hideInfoWindow();
}
-
- if (marker instanceof MarkerView) {
- markerViewManager.deselect((MarkerView) marker, false);
- }
-
selectedMarkers.remove(marker);
}
@@ -348,10 +295,6 @@ class AnnotationManager {
return infoWindowManager;
}
- MarkerViewManager getMarkerViewManager() {
- return markerViewManager;
- }
-
void adjustTopOffsetPixels(@NonNull MapboxMap mapboxMap) {
int count = annotationsArray.size();
for (int i = 0; i < count; i++) {
@@ -433,14 +376,8 @@ class AnnotationManager {
}
private boolean isClickHandledForMarker(long markerId) {
- boolean handledDefaultClick;
Marker marker = (Marker) getAnnotation(markerId);
- if (marker instanceof MarkerView) {
- handledDefaultClick = markerViewManager.onClickMarkerView((MarkerView) marker);
- } else {
- handledDefaultClick = onClickMarker(marker);
- }
-
+ boolean handledDefaultClick = onClickMarker(marker);
if (!handledDefaultClick) {
toggleMarkerSelectionState(marker);
}
@@ -481,13 +418,12 @@ class AnnotationManager {
private static class MarkerHitResolver {
@NonNull
- private final MarkerViewManager markerViewManager;
- @NonNull
private final Projection projection;
private final int minimalTouchSize;
@Nullable
private View view;
+
private Bitmap bitmap;
private int bitmapWidth;
private int bitmapHeight;
@@ -503,7 +439,6 @@ class AnnotationManager {
private long closestMarkerId = NO_ANNOTATION_ID;
MarkerHitResolver(@NonNull MapboxMap mapboxMap) {
- this.markerViewManager = mapboxMap.getMarkerViewManager();
this.projection = mapboxMap.getProjection();
this.minimalTouchSize = (int) (32 * Mapbox.getApplicationContext().getResources().getDisplayMetrics().density);
}
@@ -515,20 +450,7 @@ class AnnotationManager {
private void resolveForMarkers(MarkerHit markerHit) {
for (Marker marker : markerHit.markers) {
- if (marker instanceof MarkerView) {
- resolveForMarkerView(markerHit, (MarkerView) marker);
- } else {
- resolveForMarker(markerHit, marker);
- }
- }
- }
-
- private void resolveForMarkerView(@NonNull MarkerHit markerHit, @NonNull MarkerView markerView) {
- view = markerViewManager.getView(markerView);
- if (view != null) {
- view.getHitRect(hitRectView);
- hitRectMarker = new RectF(hitRectView);
- hitTestMarker(markerHit, markerView, hitRectMarker);
+ resolveForMarker(markerHit, marker);
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
index 7aca93fe2e..28f594c62e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
@@ -7,7 +7,6 @@ import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
import java.util.HashMap;
import java.util.List;
@@ -16,8 +15,7 @@ import java.util.Map;
/**
* Responsible for managing icons added to the Map.
* <p>
- * Maintains a {@link List} of {@link Icon} and is responsible for initialising default markers and
- * setting up {@link MarkerView} annotation ghosting.
+ * Maintains a {@link List} of {@link Icon} and is responsible for initialising default markers.
* </p>
* <p>
* Keep track of icons added and the resulting average icon size. This is used internally by our
@@ -34,15 +32,12 @@ class IconManager {
IconManager(NativeMapView nativeMapView) {
this.nativeMapView = nativeMapView;
- // load transparent icon for MarkerView to trace actual markers, see #6352
- loadIcon(IconFactory.recreate(IconFactory.ICON_MARKERVIEW_ID, IconFactory.ICON_MARKERVIEW_BITMAP));
}
Icon loadIconForMarker(@NonNull Marker marker) {
Icon icon = marker.getIcon();
if (icon == null) {
// TODO replace with anchor implementation, we are faking an anchor by adding extra pixels and diving height by 2
- // TODO we can move this code afterwards to getIcon as with MarkerView.getIcon
icon = loadDefaultIconForMarker(marker);
} else {
updateHighestIconSize(icon);
@@ -51,13 +46,6 @@ class IconManager {
return icon;
}
- void loadIconForMarkerView(@NonNull MarkerView marker) {
- Icon icon = marker.getIcon();
- Bitmap bitmap = icon.getBitmap();
- updateHighestIconSize(bitmap);
- addIcon(icon, false);
- }
-
int getTopOffsetPixelsForIcon(@NonNull Icon icon) {
return (int) (nativeMapView.getTopOffsetPixelsForAnnotationSymbol(icon.getId()) * nativeMapView.getPixelRatio());
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index 8d1592046f..676fd25505 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -15,7 +15,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.TextureView;
import android.view.View;
-import android.view.ViewGroup;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.FrameLayout;
@@ -25,7 +24,6 @@ import com.mapbox.mapboxsdk.MapStrictMode;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.annotations.Annotation;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
@@ -157,17 +155,15 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
Projection proj = new Projection(nativeMapView);
UiSettings uiSettings = new UiSettings(proj, focalInvalidator, compassView, attrView, logoView, getPixelRatio());
LongSparseArray<Annotation> annotationsArray = new LongSparseArray<>();
- MarkerViewManager markerViewManager = new MarkerViewManager((ViewGroup) findViewById(R.id.markerViewContainer));
IconManager iconManager = new IconManager(nativeMapView);
Annotations annotations = new AnnotationContainer(nativeMapView, annotationsArray);
- Markers markers = new MarkerContainer(nativeMapView, this, annotationsArray, iconManager, markerViewManager);
+ Markers markers = new MarkerContainer(nativeMapView, annotationsArray, iconManager);
Polygons polygons = new PolygonContainer(nativeMapView, annotationsArray);
Polylines polylines = new PolylineContainer(nativeMapView, annotationsArray);
ShapeAnnotations shapeAnnotations = new ShapeAnnotationContainer(nativeMapView, annotationsArray);
- AnnotationManager annotationManager = new AnnotationManager(this, annotationsArray,
- markerViewManager, iconManager, annotations, markers, polygons, polylines, shapeAnnotations);
- Transform transform = new Transform(this, nativeMapView, annotationManager.getMarkerViewManager(),
- cameraChangeDispatcher);
+ AnnotationManager annotationManager = new AnnotationManager(this, annotationsArray, iconManager,
+ annotations, markers, polygons, polylines, shapeAnnotations);
+ Transform transform = new Transform(this, nativeMapView, cameraChangeDispatcher);
// MapboxMap
mapboxMap = new MapboxMap(nativeMapView, transform, uiSettings, proj, registerTouchListener,
@@ -1159,7 +1155,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
// Style has loaded before the drawing surface has been initialized, delivering OnMapReady
mapboxMap.onPreMapReady();
onMapReady();
- mapboxMap.onPostMapReady();
}
}
@@ -1212,7 +1207,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
initialLoad = false;
mapboxMap.onPreMapReady();
onMapReady();
- mapboxMap.onPostMapReady();
} else {
mapboxMap.onFinishLoadingStyle();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
index f986d9d96c..58fc66407f 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
@@ -11,10 +11,8 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.Size;
import android.support.annotation.UiThread;
-import android.support.v4.util.Pools;
import android.text.TextUtils;
import android.view.View;
-import android.view.ViewGroup;
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.gestures.MoveGestureDetector;
@@ -26,11 +24,8 @@ import com.mapbox.geojson.Geometry;
import com.mapbox.mapboxsdk.MapStrictMode;
import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import com.mapbox.mapboxsdk.annotations.Polygon;
import com.mapbox.mapboxsdk.annotations.PolygonOptions;
import com.mapbox.mapboxsdk.annotations.Polyline;
@@ -172,23 +167,12 @@ public final class MapboxMap {
* Called before the OnMapReadyCallback is invoked.
*/
void onPreMapReady() {
- invalidateCameraPosition();
+ transform.invalidateCameraPosition();
annotationManager.reloadMarkers();
annotationManager.adjustTopOffsetPixels(this);
}
/**
- * Called when the OnMapReadyCallback has finished executing.
- * <p>
- * Invalidation of the camera position is required to update the added components in
- * OnMapReadyCallback with the correct transformation.
- * </p>
- */
- void onPostMapReady() {
- invalidateCameraPosition();
- }
-
- /**
* Called when the map will start loading style.
*/
void onStartLoadingMap() {
@@ -858,16 +842,6 @@ public final class MapboxMap {
}
/**
- * Invalidates the current camera position by reconstructing it from mbgl
- */
- private void invalidateCameraPosition() {
- CameraPosition cameraPosition = transform.invalidateCameraPosition();
- if (cameraPosition != null) {
- transform.updateCameraPosition(cameraPosition);
- }
- }
-
- /**
* Scrolls the camera over the map, shifting the center of view by the specified number of pixels in the x and y
* directions.
*
@@ -1187,85 +1161,6 @@ public final class MapboxMap {
/**
* <p>
- * Adds a marker to this map.
- * </p>
- * The marker's icon is rendered on the map at the location {@code Marker.position}.
- * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
- *
- * @param markerOptions A marker options object that defines how to render the marker
- * @return The {@code Marker} that was added to the map
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github
- * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
- * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
- @NonNull
- @Deprecated
- public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions) {
- return annotationManager.addMarker(markerOptions, this, null);
- }
-
- /**
- * <p>
- * Adds a marker to this map.
- * </p>
- * The marker's icon is rendered on the map at the location {@code Marker.position}.
- * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
- *
- * @param markerOptions A marker options object that defines how to render the marker
- * @param onMarkerViewAddedListener Callback invoked when the View has been added to the map
- * @return The {@code Marker} that was added to the map
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github
- * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
- * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
- @Deprecated
- @NonNull
- public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions,
- final MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener) {
- return annotationManager.addMarker(markerOptions, this, onMarkerViewAddedListener);
- }
-
- /**
- * Adds multiple markersViews to this map.
- * <p>
- * The marker's icon is rendered on the map at the location {@code Marker.position}.
- * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
- * </p>
- *
- * @param markerViewOptions A list of markerView options objects that defines how to render the markers
- * @return A list of the {@code MarkerView}s that were added to the map
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github
- * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
- * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
- @NonNull
- @Deprecated
- public List<MarkerView> addMarkerViews(@NonNull List<? extends
- BaseMarkerViewOptions> markerViewOptions) {
- return annotationManager.addMarkerViews(markerViewOptions, this);
- }
-
- /**
- * Returns markerViews found inside of a rectangle on this map.
- *
- * @param rect the rectangular area on the map to query for markerViews
- * @return A list of the markerViews that were found in the rectangle
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github
- * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
- * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
- @NonNull
- @Deprecated
- public List<MarkerView> getMarkerViewsInRect(@NonNull RectF rect) {
- return annotationManager.getMarkerViewsInRect(rect);
- }
-
- /**
- * <p>
* Adds multiple markers to this map.
* </p>
* The marker's icon is rendered on the map at the location {@code Marker.position}.
@@ -1559,16 +1454,6 @@ public final class MapboxMap {
return annotationManager.getSelectedMarkers();
}
- /**
- * Get the MarkerViewManager associated to the MapView.
- *
- * @return the associated MarkerViewManager
- */
- @NonNull
- public MarkerViewManager getMarkerViewManager() {
- return annotationManager.getMarkerViewManager();
- }
-
//
// InfoWindow
//
@@ -2544,145 +2429,6 @@ public final class MapboxMap {
}
/**
- * Interface definition for a callback to be invoked when an MarkerView will be shown.
- *
- * @param <U> the instance type of MarkerView
- * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android
- * SDK views to be used as a symbol see https://github
- * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android
- * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
- */
- @Deprecated
- public abstract static class MarkerViewAdapter<U extends MarkerView> {
-
- private Context context;
- private final Class<U> persistentClass;
- @NonNull
- private final Pools.SimplePool<View> viewReusePool;
-
- /**
- * Create an instance of MarkerViewAdapter.
- *
- * @param context the context associated to a MapView
- */
- public MarkerViewAdapter(Context context, Class<U> persistentClass) {
- this.context = context;
- this.persistentClass = persistentClass;
- viewReusePool = new Pools.SimplePool<>(10000);
- }
-
- /**
- * Called when an MarkerView will be added to the MapView.
- *
- * @param marker the model representing the MarkerView
- * @param convertView the reusable view
- * @param parent the parent ViewGroup of the convertview
- * @return the View that is adapted to the contents of MarkerView
- */
- @Nullable
- public abstract View getView(@NonNull U marker, @Nullable View convertView, @NonNull ViewGroup parent);
-
- /**
- * Called when an MarkerView is removed from the MapView or the View object is going to be reused.
- * <p>
- * This method should be used to reset an animated view back to it's original state for view reuse.
- * </p>
- * <p>
- * Returning true indicates you want to the view reuse to be handled automatically.
- * Returning false indicates you want to perform an animation and you are required calling
- * {@link #releaseView(View)} yourself.
- * </p>
- *
- * @param marker the model representing the MarkerView
- * @param convertView the reusable view
- * @return true if you want reuse to occur automatically, false if you want to manage this yourself.
- */
- public boolean prepareViewForReuse(@NonNull MarkerView marker, @NonNull View convertView) {
- return true;
- }
-
- /**
- * Called when a MarkerView is selected from the MapView.
- * <p>
- * Returning true from this method indicates you want to move the MarkerView to the selected state.
- * Returning false indicates you want to animate the View first an manually select the MarkerView when appropriate.
- * </p>
- *
- * @param marker the model representing the MarkerView
- * @param convertView the reusable view
- * @param reselectionFromRecycling indicates if the onSelect callback is the initial selection
- * callback or that selection occurs due to recreation of selected marker
- * @return true if you want to select the Marker immediately, false if you want to manage this yourself.
- */
- public boolean onSelect(@NonNull U marker, @NonNull View convertView, boolean reselectionFromRecycling) {
- return true;
- }
-
- /**
- * Called when a MarkerView is deselected from the MapView.
- *
- * @param marker the model representing the MarkerView
- * @param convertView the reusable view
- */
- public void onDeselect(@NonNull U marker, @NonNull View convertView) {
- }
-
- /**
- * Returns the generic type of the used MarkerView.
- *
- * @return the generic type
- */
- public final Class<U> getMarkerClass() {
- return persistentClass;
- }
-
- /**
- * Returns the pool used to store reusable Views.
- *
- * @return the pool associated to this adapter
- */
- @NonNull
- public final Pools.SimplePool<View> getViewReusePool() {
- return viewReusePool;
- }
-
- /**
- * Returns the context associated to the hosting MapView.
- *
- * @return the context used
- */
- public final Context getContext() {
- return context;
- }
-
- /**
- * Release a View to the ViewPool.
- *
- * @param view the view to be released
- */
- public final void releaseView(View view) {
- view.setVisibility(View.GONE);
- viewReusePool.release(view);
- }
- }
-
- /**
- * Interface definition for a callback to be invoked when the user clicks on a MarkerView.
- */
- public interface OnMarkerViewClickListener {
-
- /**
- * Called when the user clicks on a MarkerView.
- *
- * @param marker the MarkerView associated to the clicked View
- * @param view the clicked View
- * @param adapter the adapter used to adapt the MarkerView to the View
- * @return If true the listener has consumed the event and the info window will not be shown
- */
- boolean onMarkerClick(@NonNull Marker marker, @NonNull View view, @NonNull MarkerViewAdapter adapter);
- }
-
- /**
* Interface definition for a callback to be invoked when a task is complete or cancelled.
*/
public interface CancelableCallback {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java
index 8b9ff78aa3..26ac74904a 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MarkerContainer.java
@@ -1,19 +1,13 @@
package com.mapbox.mapboxsdk.maps;
-
import android.graphics.RectF;
import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
import android.support.v4.util.LongSparseArray;
import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Icon;
-import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import java.util.ArrayList;
import java.util.List;
@@ -24,18 +18,13 @@ import java.util.List;
class MarkerContainer implements Markers {
private final NativeMapView nativeMapView;
- private final MapView mapView;
private final LongSparseArray<Annotation> annotations;
private final IconManager iconManager;
- private final MarkerViewManager markerViewManager;
- MarkerContainer(NativeMapView nativeMapView, MapView mapView, LongSparseArray<Annotation> annotations, IconManager
- iconManager, MarkerViewManager markerViewManager) {
+ MarkerContainer(NativeMapView nativeMapView, LongSparseArray<Annotation> annotations, IconManager iconManager) {
this.nativeMapView = nativeMapView;
- this.mapView = mapView;
this.annotations = annotations;
this.iconManager = iconManager;
- this.markerViewManager = markerViewManager;
}
@Override
@@ -121,78 +110,6 @@ class MarkerContainer implements Markers {
}
@Override
- public MarkerView addViewBy(@NonNull BaseMarkerViewOptions markerOptions, @NonNull MapboxMap mapboxMap, @Nullable
- MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener) {
- final MarkerView marker = prepareViewMarker(markerOptions);
-
- // add marker to map
- marker.setMapboxMap(mapboxMap);
- long id = nativeMapView.addMarker(marker);
- marker.setId(id);
- annotations.put(id, marker);
-
- if (onMarkerViewAddedListener != null) {
- markerViewManager.addOnMarkerViewAddedListener(marker, onMarkerViewAddedListener);
- }
- markerViewManager.setEnabled(true);
- markerViewManager.setWaitingForRenderInvoke(true);
- return marker;
- }
-
- @NonNull
- @Override
- public List<MarkerView> addViewsBy(@NonNull List<? extends BaseMarkerViewOptions> markerViewOptions, @NonNull
- MapboxMap mapboxMap) {
- List<MarkerView> markers = new ArrayList<>();
- for (BaseMarkerViewOptions markerViewOption : markerViewOptions) {
- // if last marker
- if (markerViewOptions.indexOf(markerViewOption) == markerViewOptions.size() - 1) {
- // get notified when render occurs to invalidate and draw MarkerViews
- markerViewManager.setWaitingForRenderInvoke(true);
- }
- // add marker to map
- MarkerView marker = prepareViewMarker(markerViewOption);
- marker.setMapboxMap(mapboxMap);
- long id = nativeMapView.addMarker(marker);
- marker.setId(id);
- annotations.put(id, marker);
- markers.add(marker);
- }
- markerViewManager.setEnabled(true);
- markerViewManager.update();
- return markers;
- }
-
- @NonNull
- @Override
- public List<MarkerView> obtainViewsIn(@NonNull RectF rectangle) {
- float pixelRatio = nativeMapView.getPixelRatio();
- RectF rect = new RectF(rectangle.left / pixelRatio,
- rectangle.top / pixelRatio,
- rectangle.right / pixelRatio,
- rectangle.bottom / pixelRatio);
-
- long[] ids = nativeMapView.queryPointAnnotations(rect);
-
- List<Long> idsList = new ArrayList<>(ids.length);
- for (long id : ids) {
- idsList.add(id);
- }
-
- List<MarkerView> annotations = new ArrayList<>(ids.length);
- List<Annotation> annotationList = obtainAnnotations();
- int count = annotationList.size();
- for (int i = 0; i < count; i++) {
- Annotation annotation = annotationList.get(i);
- if (annotation instanceof MarkerView && idsList.contains(annotation.getId())) {
- annotations.add((MarkerView) annotation);
- }
- }
-
- return new ArrayList<>(annotations);
- }
-
- @Override
public void reload() {
iconManager.reloadIcons();
int count = annotations.size();
@@ -215,9 +132,7 @@ class MarkerContainer implements Markers {
}
private void ensureIconLoaded(Marker marker, @NonNull MapboxMap mapboxMap) {
- if (!(marker instanceof MarkerView)) {
- iconManager.ensureIconLoaded(marker, mapboxMap);
- }
+ iconManager.ensureIconLoaded(marker, mapboxMap);
}
@NonNull
@@ -228,15 +143,4 @@ class MarkerContainer implements Markers {
}
return annotations;
}
-
- private MarkerView prepareViewMarker(BaseMarkerViewOptions markerViewOptions) {
- MarkerView marker = markerViewOptions.getMarker();
- Icon icon = markerViewOptions.getIcon();
- if (icon == null) {
- icon = IconFactory.getInstance(mapView.getContext()).defaultMarkerView();
- }
- iconManager.loadIconForMarkerView(marker);
- marker.setIcon(icon);
- return marker;
- }
} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java
index d85f388d09..62859d58a8 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Markers.java
@@ -1,15 +1,10 @@
package com.mapbox.mapboxsdk.maps;
-
import android.graphics.RectF;
import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import java.util.List;
@@ -28,13 +23,5 @@ interface Markers {
@NonNull
List<Marker> obtainAllIn(@NonNull RectF rectangle);
- MarkerView addViewBy(@NonNull BaseMarkerViewOptions markerOptions, @NonNull MapboxMap mapboxMap,
- @Nullable MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener);
-
- List<MarkerView> addViewsBy(@NonNull List<? extends BaseMarkerViewOptions> markerViewOptions,
- @NonNull MapboxMap mapboxMap);
-
- List<MarkerView> obtainViewsIn(@NonNull RectF rectangle);
-
void reload();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
index 457353d4b9..0ba40642f5 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
@@ -5,7 +5,6 @@ import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
@@ -27,14 +26,12 @@ final class Transform implements MapView.OnCameraDidChangeListener {
private final NativeMapView nativeMapView;
private final MapView mapView;
- private final MarkerViewManager markerViewManager;
private final Handler handler = new Handler();
@Nullable
private CameraPosition cameraPosition;
@Nullable
private MapboxMap.CancelableCallback cameraCancelableCallback;
-
private CameraChangeDispatcher cameraChangeDispatcher;
private final MapView.OnCameraDidChangeListener moveByChangeListener = new MapView.OnCameraDidChangeListener() {
@@ -47,11 +44,9 @@ final class Transform implements MapView.OnCameraDidChangeListener {
}
};
- Transform(MapView mapView, NativeMapView nativeMapView, MarkerViewManager markerViewManager,
- CameraChangeDispatcher cameraChangeDispatcher) {
+ Transform(MapView mapView, NativeMapView nativeMapView, CameraChangeDispatcher cameraChangeDispatcher) {
this.mapView = mapView;
this.nativeMapView = nativeMapView;
- this.markerViewManager = markerViewManager;
this.cameraChangeDispatcher = cameraChangeDispatcher;
}
@@ -77,15 +72,10 @@ final class Transform implements MapView.OnCameraDidChangeListener {
return cameraPosition;
}
- @UiThread
- void updateCameraPosition(@NonNull CameraPosition position) {
- markerViewManager.setTilt((float) position.tilt);
- }
-
@Override
public void onCameraDidChange(boolean animated) {
if (animated) {
- updateCameraPosition(invalidateCameraPosition());
+ invalidateCameraPosition();
if (cameraCancelableCallback != null) {
handler.post(new Runnable() {
@Override
@@ -170,20 +160,11 @@ final class Transform implements MapView.OnCameraDidChangeListener {
cameraChangeDispatcher.onCameraMove();
}
- if (isComponentUpdateRequired(cameraPosition)) {
- updateCameraPosition(cameraPosition);
- }
-
this.cameraPosition = cameraPosition;
}
return cameraPosition;
}
- private boolean isComponentUpdateRequired(@NonNull CameraPosition cameraPosition) {
- return this.cameraPosition != null && (this.cameraPosition.tilt != cameraPosition.tilt
- || this.cameraPosition.bearing != cameraPosition.bearing);
- }
-
void cancelTransitions() {
// notify user about cancel
cameraChangeDispatcher.onCameraMoveCanceled();
@@ -279,7 +260,6 @@ final class Transform implements MapView.OnCameraDidChangeListener {
}
void setTilt(Double pitch) {
- markerViewManager.setTilt(pitch.floatValue());
nativeMapView.setPitch(pitch, 0);
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java
index 0c529aa464..9617f94fce 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java
@@ -5,6 +5,7 @@ import android.support.annotation.CallSuper;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
+import com.mapbox.mapboxsdk.log.Logger;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.storage.FileSource;
@@ -21,6 +22,8 @@ import javax.microedition.khronos.opengles.GL10;
@Keep
public abstract class MapRenderer implements MapRendererScheduler {
+ private static final String TAG = "Mbgl-MapRenderer";
+
// Holds the pointer to the native peer after initialisation
private long nativePtr = 0;
@@ -72,8 +75,11 @@ public abstract class MapRenderer implements MapRendererScheduler {
@CallSuper
protected void onDrawFrame(GL10 gl) {
- nativeRender();
-
+ try {
+ nativeRender();
+ } catch (java.lang.Error error) {
+ Logger.e(TAG, error.getMessage());
+ }
if (onFpsChangedListener != null) {
updateFps();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml
index bd3eb92081..7421292c65 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml
+++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml
@@ -1,13 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
- <FrameLayout
- android:id="@+id/markerViewContainer"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@android:color/transparent"
- android:contentDescription="@null"/>
-
<com.mapbox.mapboxsdk.maps.widgets.CompassView
android:id="@+id/compassView"
android:layout_width="wrap_content"
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java
deleted file mode 100644
index ebd30f5422..0000000000
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/annotations/MarkerViewTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-package com.mapbox.mapboxsdk.annotations;
-
-import android.os.Parcelable;
-
-import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.utils.MockParcel;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class MarkerViewTest {
-
- @Mock
- MapboxMap mapboxMap;
-
- @Mock
- MarkerViewManager markerViewManager;
-
- @Before
- public void beforeTest() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testSanity() {
- MarkerViewOptions markerOptions = new MarkerViewOptions();
- assertNotNull("markerOptions should not be null", markerOptions);
- }
-
- @Test
- public void testMarker() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng());
- assertNotNull("marker should not be null", markerOptions.getMarker());
- }
-
- @Test(expected = InvalidMarkerPositionException.class)
- public void testInvalidMarker() {
- new MarkerViewOptions().getMarker();
- }
-
- @Test
- public void testPosition() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng(10, 12));
- MarkerView marker = markerOptions.getMarker();
- assertEquals(marker.getPosition(), new LatLng(10, 12));
- assertEquals(markerOptions.getPosition(), new LatLng(10, 12));
- }
-
- @Test
- public void testSnippet() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().snippet("Mapbox").position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertEquals(marker.getSnippet(), "Mapbox");
- }
-
- @Test
- public void testTitle() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().title("Mapbox").position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertEquals(marker.getTitle(), "Mapbox");
- assertEquals(markerOptions.getTitle(), "Mapbox");
- }
-
- @Test
- public void testFlat() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().flat(true).position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertTrue("flat should be true", marker.isFlat());
- }
-
- @Test
- public void testFlatDefault() {
- assertFalse("default value of flat should be false", new MarkerViewOptions().position(
- new LatLng()).getMarker().isFlat());
- }
-
- @Test
- public void testAnchor() {
- float anchorU = 1;
- float anchorV = 1;
- MarkerViewOptions markerOptions = new MarkerViewOptions().anchor(anchorU, anchorV).position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertEquals("anchorU should match ", anchorU, marker.getAnchorU(), 0);
- assertEquals("anchorU should match ", anchorV, marker.getAnchorV(), 0);
- }
-
- @Test
- public void testAnchorDefault() {
- MarkerView marker = new MarkerViewOptions().position(new LatLng()).getMarker();
- assertEquals("anchorU should match ", 0.5, marker.getAnchorU(), 0);
- assertEquals("anchorU should match ", 1, marker.getAnchorV(), 0);
- }
-
- @Test
- public void testInfoWindowAnchor() {
- float anchorU = 1;
- float anchorV = 1;
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng()).infoWindowAnchor(anchorU, anchorV);
- MarkerView marker = markerOptions.getMarker();
- assertEquals("anchorU should match ", 1, marker.getInfoWindowAnchorU(), 0);
- assertEquals("anchorU should match ", 1, marker.getInfoWindowAnchorV(), 0);
- }
-
- @Test
- public void testInfoWindowAnchorDefault() {
- MarkerView marker = new MarkerViewOptions().position(new LatLng()).getMarker();
- assertEquals("anchorU should match ", 0.5, marker.getInfoWindowAnchorU(), 0);
- assertEquals("anchorU should match ", 0, marker.getInfoWindowAnchorV(), 0);
- }
-
- @Test
- public void testRotation() {
- int rotation = 90;
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng()).rotation(rotation);
- MarkerView marker = markerOptions.getMarker();
- assertEquals("rotation should match ", rotation, marker.getRotation(), 0);
- }
-
- @Test
- public void testRotationAboveMax() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().rotation(390).position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertEquals(marker.getRotation(), 30, 0);
- }
-
- @Test
- public void testRotationBelowMin() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().rotation(-10).position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertEquals(marker.getRotation(), 350, 0);
- }
-
- @Test
- public void testVisible() {
- boolean visible = false;
- MarkerViewOptions markerOptions = new MarkerViewOptions().visible(visible).position(new LatLng());
- MarkerView marker = markerOptions.getMarker();
- assertEquals("visible should match ", visible, marker.isVisible());
- }
-
- @Test
- public void testVisibleDefault() {
- assertTrue(new MarkerViewOptions().position(new LatLng()).getMarker().isVisible());
- }
-
- @Test
- public void testBuilder() {
- MarkerView marker = new MarkerViewOptions().title("title").snippet("snippet").position(
- new LatLng(10, 12)).getMarker();
- assertEquals(marker.getSnippet(), "snippet");
- assertEquals(marker.getPosition(), new LatLng(10, 12));
- }
-
- @Test
- public void testHashCode() {
- MarkerView marker = new MarkerViewOptions().position(new LatLng()).getMarker();
- assertEquals("hash code should match", marker.hashCode(), 0);
- }
-
- @Test
- public void testHashCodeBuilder() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng(10, 12));
- assertEquals("hash code should match", markerOptions.hashCode(), 0);
- }
-
- @Test
- public void testEquals() {
- MarkerView markerOne = new MarkerViewOptions().position(new LatLng(0, 0)).getMarker();
- MarkerView markerTwo = new MarkerViewOptions().position(new LatLng(0, 0)).getMarker();
- assertEquals(markerOne, markerTwo);
- }
-
- @Test
- public void testEqualsItself() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng(0, 0));
- MarkerView marker = markerOptions.getMarker();
- assertEquals("MarkerView should match", marker, marker);
- assertEquals("MarkerViewOptions should match", markerOptions, markerOptions);
- }
-
- @Test
- public void testNotEquals() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng(0, 0));
- MarkerView marker = markerOptions.getMarker();
- assertNotEquals("MarkerViewOptions should match", markerOptions, new Object());
- assertNotEquals("MarkerView should match", marker, new Object());
- }
-
- @Test
- public void testEqualityBuilder() {
- MarkerViewOptions markerOne = new MarkerViewOptions().position(new LatLng(0, 0));
- MarkerViewOptions markerTwo = new MarkerViewOptions().position(new LatLng(0, 0));
- assertEquals(markerOne, markerTwo);
- }
-
- @Test
- public void testToString() {
- MarkerView marker = new MarkerViewOptions().position(new LatLng(0, 0)).getMarker();
- assertEquals(marker.toString(), "MarkerView [position["
- + "LatLng [latitude=0.0, longitude=0.0, altitude=0.0]" + "]]");
- }
-
- @Test
- public void testParcelable() {
- MarkerViewOptions markerOptions = new MarkerViewOptions().position(new LatLng()).title("t").snippet("s");
- Parcelable parcelable = MockParcel.obtain(markerOptions);
- assertEquals("Parcel should match original object", parcelable, markerOptions);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java
index a2f0486020..9ca8eefe92 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/AnnotationManagerTest.java
@@ -6,7 +6,6 @@ import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
import com.mapbox.mapboxsdk.geometry.LatLng;
import org.junit.Test;
@@ -27,15 +26,14 @@ public class AnnotationManagerTest {
NativeMapView aNativeMapView = mock(NativeMapView.class);
MapView aMapView = mock(MapView.class);
LongSparseArray<Annotation> annotationsArray = new LongSparseArray<>();
- MarkerViewManager aMarkerViewManager = mock(MarkerViewManager.class);
IconManager aIconManager = mock(IconManager.class);
Annotations annotations = new AnnotationContainer(aNativeMapView, annotationsArray);
- Markers markers = new MarkerContainer(aNativeMapView, aMapView, annotationsArray, aIconManager, aMarkerViewManager);
+ Markers markers = new MarkerContainer(aNativeMapView, annotationsArray, aIconManager);
Polygons polygons = new PolygonContainer(aNativeMapView, annotationsArray);
Polylines polylines = new PolylineContainer(aNativeMapView, annotationsArray);
ShapeAnnotations shapeAnnotations = new ShapeAnnotationContainer(aNativeMapView, annotationsArray);
AnnotationManager annotationManager = new AnnotationManager(aMapView, annotationsArray,
- aMarkerViewManager, aIconManager, annotations, markers, polygons, polylines, shapeAnnotations);
+ aIconManager, annotations, markers, polygons, polylines, shapeAnnotations);
Marker aMarker = mock(Marker.class);
long aId = 5L;
when(aNativeMapView.addMarker(aMarker)).thenReturn(aId);
@@ -54,15 +52,15 @@ public class AnnotationManagerTest {
NativeMapView aNativeMapView = mock(NativeMapView.class);
MapView aMapView = mock(MapView.class);
LongSparseArray<Annotation> annotationsArray = new LongSparseArray<>();
- MarkerViewManager aMarkerViewManager = mock(MarkerViewManager.class);
IconManager aIconManager = mock(IconManager.class);
Annotations annotations = new AnnotationContainer(aNativeMapView, annotationsArray);
- Markers markers = new MarkerContainer(aNativeMapView, aMapView, annotationsArray, aIconManager, aMarkerViewManager);
+ Markers markers = new MarkerContainer(aNativeMapView, annotationsArray, aIconManager);
Polygons polygons = new PolygonContainer(aNativeMapView, annotationsArray);
Polylines polylines = new PolylineContainer(aNativeMapView, annotationsArray);
ShapeAnnotations shapeAnnotations = new ShapeAnnotationContainer(aNativeMapView, annotationsArray);
AnnotationManager annotationManager = new AnnotationManager(aMapView, annotationsArray,
- aMarkerViewManager, aIconManager, annotations, markers, polygons, polylines, shapeAnnotations);
+ aIconManager, annotations, markers, polygons, polylines, shapeAnnotations);
+
long firstId = 1L;
long secondId = 2L;
List<BaseMarkerOptions> markerList = new ArrayList<>();
@@ -75,7 +73,7 @@ public class AnnotationManagerTest {
when(aNativeMapView.addMarker(any(Marker.class))).thenReturn(firstId, secondId);
when(aNativeMapView.addMarkers(ArgumentMatchers.<Marker>anyList()))
- .thenReturn(new long[]{firstId, secondId});
+ .thenReturn(new long[] {firstId, secondId});
annotationManager.addMarkers(markerList, aMapboxMap);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
deleted file mode 100644
index ad153336a4..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.annotation.MarkerViewActivity;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerViewOptions;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
-import static org.junit.Assert.assertEquals;
-
-public class MarkerViewTest extends BaseActivityTest {
-
- private Marker marker;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void addMarkerViewTest() {
- validateTestSetup();
- addAdapter();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
-
- TextMarkerViewOptions options = new TextMarkerViewOptions();
- options.text(TestConstants.TEXT_MARKER_TEXT);
- options.position(new LatLng());
- options.snippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.title(TestConstants.TEXT_MARKER_TITLE);
- marker = mapboxMap.addMarker(options);
- assertEquals("Markers size should be 1, ", 1, mapboxMap.getMarkers().size());
- assertEquals("Marker id should be 0", 0, marker.getId());
- assertEquals("Marker target should match", new LatLng(), marker.getPosition());
- assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet());
- assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle());
- uiController.loopMainThreadForAtLeast(500);
- });
- onView(withText(TestConstants.TEXT_MARKER_TEXT)).check(matches(isDisplayed()));
- }
-
- @Test
- @Ignore
- public void showInfoWindowTest() {
- validateTestSetup();
- addAdapter();
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- final TextMarkerViewOptions options = new TextMarkerViewOptions();
- options.position(new LatLng());
- options.text(TestConstants.TEXT_MARKER_TEXT);
- options.snippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.title(TestConstants.TEXT_MARKER_TITLE);
- marker = mapboxMap.addMarker(options);
- uiController.loopMainThreadForAtLeast(500);
- mapboxMap.selectMarker(marker);
- });
- onView(withText(TestConstants.TEXT_MARKER_TEXT)).check(matches(isDisplayed()));
- onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed()));
- onView(withText(TestConstants.TEXT_MARKER_SNIPPET)).check(matches(isDisplayed()));
- }
-
- private void addAdapter() {
- invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.getMarkerViewManager().addMarkerViewAdapter(
- new MarkerViewActivity.TextAdapter(rule.getActivity(), mapboxMap)));
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
index d6dca8664a..d30265f18a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
@@ -372,17 +372,6 @@
android:value=".activity.FeatureOverviewActivity" />
</activity>
<activity
- android:name=".activity.annotation.MarkerViewActivity"
- android:description="@string/description_view_marker"
- android:label="@string/activity_view_marker">
- <meta-data
- android:name="@string/category"
- android:value="@string/category_annotation" />
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value=".activity.FeatureOverviewActivity" />
- </activity>
- <activity
android:name=".activity.fragment.ViewPagerActivity"
android:description="@string/description_viewpager"
android:label="@string/activity_viewpager">
@@ -670,17 +659,6 @@
android:value=".activity.FeatureOverviewActivity" />
</activity>
<activity
- android:name=".activity.annotation.MarkerViewsInRectangleActivity"
- android:description="@string/description_marker_view_rectangle"
- android:label="@string/activity_marker_view_rectangle">
- <meta-data
- android:name="@string/category"
- android:value="@string/category_annotation" />
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value=".activity.FeatureOverviewActivity" />
- </activity>
- <activity
android:name=".activity.maplayout.LatLngBoundsForCameraActivity"
android:description="@string/description_restricted_bounds"
android:label="@string/activity_restricted_bounds">
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java
index 599cddfb6e..27303901a0 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedSymbolLayerActivity.java
@@ -34,7 +34,7 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotate;
/**
- * Test activity showcasing animating MarkerViews.
+ * Test activity showcasing animating a SymbolLayer.
*/
public class AnimatedSymbolLayerActivity extends AppCompatActivity {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
index 88b09bb959..1c798b1d7a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java
@@ -1,11 +1,8 @@
package com.mapbox.mapboxsdk.testapp.activity.annotation;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
@@ -14,37 +11,30 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.Toast;
-import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerViewOptions;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil;
-import com.mapbox.mapboxsdk.testapp.utils.IconUtils;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
import java.util.Random;
import timber.log.Timber;
/**
- * Test activity showcasing adding a large amount of Markers or MarkerViews.
+ * Test activity showcasing adding a large amount of Markers.
*/
public class BulkMarkerActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private MapboxMap mapboxMap;
private MapView mapView;
- private boolean customMarkerView;
private List<LatLng> locations;
private ProgressDialog progressDialog;
@@ -56,11 +46,6 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(mapboxMap -> BulkMarkerActivity.this.mapboxMap = mapboxMap);
-
- final View fab = findViewById(R.id.fab);
- if (fab != null) {
- fab.setOnClickListener(new FabClickListener());
- }
}
@Override
@@ -99,38 +84,11 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
}
mapboxMap.clear();
-
if (locations.size() < amount) {
amount = locations.size();
}
- if (customMarkerView) {
- showViewMarkers(amount);
- } else {
- showGlMarkers(amount);
- }
- }
-
- private void showViewMarkers(int amount) {
- DecimalFormat formatter = new DecimalFormat("#.#####");
- Random random = new Random();
- int randomIndex;
-
- int color = ResourcesCompat.getColor(getResources(), R.color.redAccent, getTheme());
- Icon icon = IconUtils.drawableToIcon(this, R.drawable.ic_droppin, color);
-
- List<MarkerViewOptions> markerOptionsList = new ArrayList<>();
- for (int i = 0; i < amount; i++) {
- randomIndex = random.nextInt(locations.size());
- LatLng latLng = locations.get(randomIndex);
- MarkerViewOptions markerOptions = new MarkerViewOptions()
- .position(latLng)
- .icon(icon)
- .title(String.valueOf(i))
- .snippet(formatter.format(latLng.getLatitude()) + ", " + formatter.format(latLng.getLongitude()));
- markerOptionsList.add(markerOptions);
- }
- mapboxMap.addMarkerViews(markerOptionsList);
+ showGlMarkers(amount);
}
private void showGlMarkers(int amount) {
@@ -198,67 +156,6 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
mapView.onLowMemory();
}
- private class FabClickListener implements View.OnClickListener {
-
- private TextView viewCountView;
-
- @Override
- public void onClick(final View view) {
- if (mapboxMap != null) {
- customMarkerView = true;
-
- // remove fab
- view.animate().alpha(0).setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- view.setVisibility(View.GONE);
- }
- }).start();
-
- // reload markers
- Spinner spinner = (Spinner) findViewById(R.id.spinner);
- if (spinner != null) {
- int amount = Integer.valueOf(
- getResources().getStringArray(R.array.bulk_marker_list)[spinner.getSelectedItemPosition()]);
- showMarkers(amount);
- }
-
- viewCountView = (TextView) findViewById(R.id.countView);
-
- mapView.addOnCameraIsChangingListener(new MapView.OnCameraIsChangingListener() {
- @Override
- public void onCameraIsChanging() {
- onCameraChange();
- }
- });
-
- mapView.addOnCameraDidChangeListener(new MapView.OnCameraDidChangeListener() {
- @Override
- public void onCameraDidChange(boolean animated) {
- onCameraChange();
- }
- });
-
- mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener(
- (marker, view1, adapter) -> {
- Toast.makeText(
- BulkMarkerActivity.this,
- "Hello " + marker.getId(),
- Toast.LENGTH_SHORT).show();
- return false;
- });
- }
- }
-
- private void onCameraChange() {
- if (!mapboxMap.getMarkerViewManager().getMarkerViewAdapters().isEmpty()) {
- viewCountView.setText(String.format(Locale.getDefault(), "ViewCache size %d",
- mapboxMap.getMarkerViewManager().getMarkerViewContainer().getChildCount()));
- }
- }
- }
-
private static class LoadLocationTask extends AsyncTask<Void, Integer, List<LatLng>> {
private WeakReference<BulkMarkerActivity> activity;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
deleted file mode 100644
index fc35434be0..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
+++ /dev/null
@@ -1,490 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.activity.annotation;
-
-import android.animation.Animator;
-import android.animation.AnimatorInflater;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.FloatEvaluator;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.mapbox.mapboxsdk.annotations.Icon;
-import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
-import com.mapbox.mapboxsdk.annotations.MarkerViewOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerView;
-import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerViewOptions;
-import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerView;
-import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerViewOptions;
-
-import java.util.Locale;
-import java.util.Random;
-
-/**
- * Test activity showcasing multiple MarkerViews above Washington D.C.
- * <p>
- * Shows a couple of open InfoWindows out of current Viewport.
- * Updates the rotation and location of a couple of MarkerViews.
- * </p>
- */
-public class MarkerViewActivity extends AppCompatActivity {
-
- private static final LatLng[] LAT_LNGS = new LatLng[] {
- new LatLng(38.897424, -77.036508),
- new LatLng(38.909698, -77.029642),
- new LatLng(38.907227, -77.036530),
- new LatLng(38.905607, -77.031916),
- new LatLng(38.889441, -77.050134),
- new LatLng(38.888000, -77.050000) // Slight overlap to show re-ordering on selection
- };
-
- private MapboxMap mapboxMap;
- private MapView mapView;
- private TextView viewCountView;
-
- // MarkerView location updates
- private MarkerView movingMarkerOne;
- private MarkerView movingMarkerTwo;
- private Random randomAnimator = new Random();
- private Handler locationUpdateHandler = new Handler();
- private Runnable moveMarkerRunnable = new MoveMarkerRunnable();
-
- // MarkerView rotate updates
- private MarkerView rotateMarker;
- private Handler rotateUpdateHandler = new Handler();
- private Runnable rotateMarkerRunnable = new RotateMarkerRunnable();
- private int rotation = 360;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_marker_view);
-
- viewCountView = (TextView) findViewById(R.id.countView);
- mapView = (MapView) findViewById(R.id.mapView);
- mapView.onCreate(savedInstanceState);
- mapView.getMapAsync(mapboxMap -> {
- MarkerViewActivity.this.mapboxMap = mapboxMap;
-
- final MarkerViewManager markerViewManager = mapboxMap.getMarkerViewManager();
-
- Icon usFlag = IconFactory.getInstance(MarkerViewActivity.this)
- .fromResource(R.drawable.ic_us);
-
- // add default ViewMarker markers
- for (int i = 0; i < LAT_LNGS.length; i++) {
- MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions()
- .position(LAT_LNGS[i])
- .title(String.valueOf(i))
- .alpha(0.5f)
- .icon(usFlag)
- );
- }
-
- // add custom ViewMarker
- CountryMarkerViewOptions options = new CountryMarkerViewOptions();
- options.flagRes(R.drawable.icon_burned);
- options.abbrevName("Mapbox");
- options.title("Hello");
- options.position(new LatLng(38.899774, -77.023237));
- options.flat(true);
- MarkerView markerView = mapboxMap.addMarker(options);
-
- // Use object animator to rotate MarkerView
- ValueAnimator markerAnimator = ObjectAnimator.ofObject(markerView, "rotation", new FloatEvaluator(), -90, 90);
- markerAnimator.setDuration(5000);
- markerAnimator.start();
-
- MarkerViewActivity.this.mapboxMap.addMarker(new MarkerOptions()
- .title("United States")
- .position(new LatLng(38.902580, -77.050102))
- );
-
- rotateMarker = MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions()
- .text("A")
- .rotation(rotation = 270)
- .position(new LatLng(38.889876, -77.008849))
- );
- loopMarkerRotate();
-
-
- MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions()
- .text("B")
- .position(new LatLng(38.907327, -77.041293))
- );
-
- MarkerViewActivity.this.mapboxMap.addMarker(new TextMarkerViewOptions()
- .text("C")
- .position(new LatLng(38.897642, -77.041980))
- );
-
- // if you want to customise a ViewMarker you need to extend ViewMarker and provide an adapter implementation
- // set adapters for child classes of ViewMarker
- markerViewManager.addMarkerViewAdapter(new CountryAdapter(MarkerViewActivity.this, mapboxMap));
- markerViewManager.addMarkerViewAdapter(new TextAdapter(MarkerViewActivity.this, mapboxMap));
-
-
- // add a change listener to validate the size of amount of child views
- mapView.addOnCameraDidChangeListener(new MapView.OnCameraDidChangeListener() {
- @Override
- public void onCameraDidChange(boolean animated) {
- setViewCount();
- }
- });
-
- // add a OnMarkerView click listener
- MarkerViewActivity.this.mapboxMap.getMarkerViewManager().setOnMarkerViewClickListener(
- (marker, view, adapter) -> {
- Toast.makeText(MarkerViewActivity.this, "Hello " + marker.getId(), Toast.LENGTH_SHORT).show();
- return false;
- });
-
- movingMarkerOne = MarkerViewActivity.this.mapboxMap.addMarker(new MarkerViewOptions()
- .position(CarLocation.CAR_0_LNGS[0])
- .icon(IconFactory.getInstance(mapView.getContext())
- .fromResource(R.drawable.ic_android))
- );
-
- movingMarkerTwo = mapboxMap.addMarker(new MarkerViewOptions()
- .position(CarLocation.CAR_1_LNGS[0])
- .icon(IconFactory.getInstance(mapView.getContext())
- .fromResource(R.drawable.ic_android_2))
- );
-
- // allow more open infowindows at the same time
- mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true);
-
- // add offscreen markers
- Marker markerRightOffScreen = mapboxMap.addMarker(new MarkerOptions()
- .setPosition(new LatLng(38.892846, -76.909399))
- .title("InfoWindow")
- .snippet("Offscreen, to the right of the Map."));
-
- Marker markerRightBottomOffScreen = mapboxMap.addMarker(new MarkerOptions()
- .setPosition(new LatLng(38.791645, -77.039006))
- .title("InfoWindow")
- .snippet("Offscreen, to the bottom of the Map"));
-
- // open infowindow offscreen markers
- mapboxMap.selectMarker(markerRightOffScreen);
- mapboxMap.selectMarker(markerRightBottomOffScreen);
- });
- }
-
- private void setViewCount() {
- final MarkerViewManager markerViewManager = mapboxMap.getMarkerViewManager();
- final ViewGroup markerViewContainer = markerViewManager.getMarkerViewContainer();
- if (!markerViewManager.getMarkerViewAdapters().isEmpty() && viewCountView != null) {
- viewCountView.setText(String.format(
- Locale.getDefault(),
- getString(R.string.viewcache_size),
- markerViewContainer.getChildCount())
- );
- }
- }
-
- private void loopMarkerRotate() {
- rotateUpdateHandler.postDelayed(rotateMarkerRunnable, 800);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- mapView.onStart();
- loopMarkerMove();
- }
-
- private void loopMarkerMove() {
- locationUpdateHandler.postDelayed(moveMarkerRunnable, randomAnimator.nextInt(3000) + 1000);
- }
-
- @Override
- protected void onStop() {
- super.onStop();
- mapView.onStop();
- locationUpdateHandler.removeCallbacks(moveMarkerRunnable);
- rotateUpdateHandler.removeCallbacks(rotateMarkerRunnable);
- }
-
- /**
- * Updates the position of a Marker
- */
- private class MoveMarkerRunnable implements Runnable {
- @Override
- public void run() {
- int randomInteger = randomAnimator.nextInt(9);
- if (randomAnimator.nextInt() % 2 == 0) {
- movingMarkerOne.setPosition(CarLocation.CAR_0_LNGS[randomInteger]);
- } else {
- movingMarkerTwo.setPosition(CarLocation.CAR_1_LNGS[randomInteger]);
- }
- loopMarkerMove();
- }
- }
-
- /**
- * Updates the rotation of a Marker
- */
- private class RotateMarkerRunnable implements Runnable {
-
- private static final int ROTATION_INCREASE_VALUE = 9;
-
- @Override
- public void run() {
- rotation -= ROTATION_INCREASE_VALUE;
- if (rotation >= 0) {
- rotation += 360;
- }
- rotateMarker.setRotation(rotation);
- loopMarkerRotate();
- }
- }
-
- /**
- * Adapts a MarkerView to display an abbreviated name in a TextView and a flag in an ImageView.
- */
- private static class CountryAdapter extends MapboxMap.MarkerViewAdapter<CountryMarkerView> {
-
- private LayoutInflater inflater;
- private MapboxMap mapboxMap;
-
- CountryAdapter(@NonNull Context context, @NonNull MapboxMap mapboxMap) {
- super(context, CountryMarkerView.class);
- this.inflater = LayoutInflater.from(context);
- this.mapboxMap = mapboxMap;
- }
-
- @Nullable
- @Override
- public View getView(@NonNull CountryMarkerView marker, @Nullable View convertView, @NonNull ViewGroup parent) {
- ViewHolder viewHolder;
- if (convertView == null) {
- viewHolder = new ViewHolder();
- convertView = inflater.inflate(R.layout.view_custom_marker, parent, false);
- viewHolder.flag = (ImageView) convertView.findViewById(R.id.imageView);
- viewHolder.abbrev = (TextView) convertView.findViewById(R.id.textView);
- convertView.setTag(viewHolder);
- } else {
- viewHolder = (ViewHolder) convertView.getTag();
- }
- viewHolder.flag.setImageResource(marker.getFlagRes());
- viewHolder.abbrev.setText(marker.getAbbrevName());
- return convertView;
- }
-
- @Override
- public boolean onSelect(
- @NonNull final CountryMarkerView marker, @NonNull final View convertView, boolean reselectionForViewReuse) {
- convertView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(convertView, View.ROTATION, 0, 360);
- rotateAnimator.setDuration(reselectionForViewReuse ? 0 : 350);
- rotateAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- convertView.setLayerType(View.LAYER_TYPE_NONE, null);
- mapboxMap.selectMarker(marker);
- }
- });
- rotateAnimator.start();
-
- // false indicates that we are calling selectMarker after our animation ourselves
- // true will let the system call it for you, which will result in showing an InfoWindow instantly
- return false;
- }
-
- @Override
- public void onDeselect(@NonNull CountryMarkerView marker, @NonNull final View convertView) {
- convertView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(convertView, View.ROTATION, 360, 0);
- rotateAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- convertView.setLayerType(View.LAYER_TYPE_NONE, null);
- }
- });
- rotateAnimator.start();
- }
-
- private static class ViewHolder {
- ImageView flag;
- TextView abbrev;
- }
- }
-
- /**
- * Adapts a MarkerView to display text in a TextView.
- */
- public static class TextAdapter extends MapboxMap.MarkerViewAdapter<TextMarkerView> {
-
- private LayoutInflater inflater;
- private MapboxMap mapboxMap;
-
- public TextAdapter(@NonNull Context context, @NonNull MapboxMap mapboxMap) {
- super(context, TextMarkerView.class);
- this.inflater = LayoutInflater.from(context);
- this.mapboxMap = mapboxMap;
- }
-
- @Nullable
- @Override
- public View getView(@NonNull TextMarkerView marker, @Nullable View convertView, @NonNull ViewGroup parent) {
- ViewHolder viewHolder;
- if (convertView == null) {
- viewHolder = new ViewHolder();
- convertView = inflater.inflate(R.layout.view_text_marker, parent, false);
- viewHolder.textView = (TextView) convertView.findViewById(R.id.textView);
- convertView.setTag(viewHolder);
- } else {
- viewHolder = (ViewHolder) convertView.getTag();
- }
- viewHolder.textView.setText(marker.getText());
- return convertView;
- }
-
- @Override
- public boolean onSelect(
- @NonNull final TextMarkerView marker, @NonNull final View convertView, boolean reselectionForViewReuse) {
- animateGrow(marker, convertView, 0);
-
- // false indicates that we are calling selectMarker after our animation ourselves
- // true will let the system call it for you, which will result in showing an InfoWindow instantly
- return false;
- }
-
- @Override
- public void onDeselect(@NonNull TextMarkerView marker, @NonNull final View convertView) {
- animateShrink(convertView, 350);
- }
-
- @Override
- public boolean prepareViewForReuse(@NonNull MarkerView marker, @NonNull View convertView) {
- // this method is called before a view will be reused, we need to restore view state
- // as we have scaled the view in onSelect. If not correctly applied other MarkerView will
- // become large since these have been recycled
-
- // cancel ongoing animation
- convertView.animate().cancel();
-
- if (marker.isSelected()) {
- // shrink view to be able to be reused
- animateShrink(convertView, 0);
- }
-
- // true if you want reuse to occur automatically, false if you want to manage this yourself
- return true;
- }
-
- private void animateGrow(@NonNull final MarkerView marker, @NonNull final View convertView, int duration) {
- convertView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- Animator animator = AnimatorInflater.loadAnimator(convertView.getContext(), R.animator.scale_up);
- animator.setDuration(duration);
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- convertView.setLayerType(View.LAYER_TYPE_NONE, null);
- mapboxMap.selectMarker(marker);
- }
- });
- animator.setTarget(convertView);
- animator.start();
- }
-
- private void animateShrink(@NonNull final View convertView, int duration) {
- convertView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
- Animator animator = AnimatorInflater.loadAnimator(convertView.getContext(), R.animator.scale_down);
- animator.setDuration(duration);
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- convertView.setLayerType(View.LAYER_TYPE_NONE, null);
- }
- });
- animator.setTarget(convertView);
- animator.start();
- }
-
- private static class ViewHolder {
- TextView textView;
- }
- }
-
-
- @Override
- public void onResume() {
- super.onResume();
- mapView.onResume();
- }
-
- @Override
- public void onPause() {
- super.onPause();
- mapView.onPause();
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- mapView.onSaveInstanceState(outState);
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- mapView.onDestroy();
- }
-
- @Override
- public void onLowMemory() {
- super.onLowMemory();
- mapView.onLowMemory();
- }
-
- private static class CarLocation {
-
- static LatLng[] CAR_0_LNGS = new LatLng[] {
- new LatLng(38.92334425495122, -77.0533673443786),
- new LatLng(38.9234737236897, -77.05389484528261),
- new LatLng(38.9257094658146, -76.98819752280579),
- new LatLng(38.8324328369647, -77.00690648325929),
- new LatLng(38.87540698725855, -77.0093148713099),
- new LatLng(38.96499498141065, -77.07707916040054),
- new LatLng(38.90794910679896, -76.99695304153806),
- new LatLng(38.86234025281626, -76.9950528034839),
- new LatLng(38.862930274733635, -76.99647808241964)
- };
-
- static LatLng[] CAR_1_LNGS = new LatLng[] {
- new LatLng(38.94237975070426, -76.98324549005675),
- new LatLng(38.941520236084486, -76.98234257804742),
- new LatLng(38.85972219720714, -76.98955808483929),
- new LatLng(38.944289166113776, -76.98584257252891),
- new LatLng(38.94375860578053, -76.98470344318412),
- new LatLng(38.943167431929645, -76.98373163938666),
- new LatLng(38.882834728904605, -77.02862535635137),
- new LatLng(38.882869724926245, -77.02992539231113),
- new LatLng(38.9371988177896, -76.97786740676564)
- };
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java
deleted file mode 100644
index d590d0dac4..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.activity.annotation;
-
-import android.graphics.RectF;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v7.app.AppCompatActivity;
-import android.view.View;
-import android.widget.Toast;
-
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewOptions;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapView;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
-import com.mapbox.mapboxsdk.testapp.R;
-
-import java.util.List;
-
-import timber.log.Timber;
-
-/**
- * Test activity showcasing counting MarkerViews in a rectangle.
- */
-public class MarkerViewsInRectangleActivity extends AppCompatActivity implements OnMapReadyCallback,
- View.OnClickListener {
-
- public MapView mapView;
- private MapboxMap mapboxMap;
- private View selectionBox;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_marker_view_in_rect);
-
- selectionBox = findViewById(R.id.selection_box);
-
- // Initialize map as normal
- mapView = (MapView) findViewById(R.id.mapView);
- mapView.onCreate(savedInstanceState);
- mapView.getMapAsync(this);
- }
-
- @Override
- public void onMapReady(@NonNull MapboxMap mapboxMap) {
- MarkerViewsInRectangleActivity.this.mapboxMap = mapboxMap;
- selectionBox.setOnClickListener(this);
- mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.0907, 5.1214), 16));
- mapboxMap.addMarker(new MarkerViewOptions().position(new LatLng(52.0907, 5.1214)));
- }
-
- @Override
- public void onClick(View view) {
- // Query
- int top = selectionBox.getTop() - mapView.getTop();
- int left = selectionBox.getLeft() - mapView.getLeft();
- RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight());
- Timber.i("Querying box %s", box);
- List<MarkerView> markers = mapboxMap.getMarkerViewsInRect(box);
-
- // Show count
- Toast.makeText(
- MarkerViewsInRectangleActivity.this,
- String.format("%s markers inside box", markers.size()),
- Toast.LENGTH_SHORT).show();
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- mapView.onStart();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mapView.onResume();
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mapView.onPause();
- }
-
- @Override
- protected void onStop() {
- super.onStop();
- mapView.onStop();
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- mapView.onSaveInstanceState(outState);
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- mapView.onDestroy();
- }
-
- @Override
- public void onLowMemory() {
- super.onLowMemory();
- mapView.onLowMemory();
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java
index 9c3da59d55..f6774696fb 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java
@@ -8,8 +8,8 @@ import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.mapbox.mapboxsdk.annotations.InfoWindow;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-import com.mapbox.mapboxsdk.annotations.MarkerViewOptions;
+import com.mapbox.mapboxsdk.annotations.Marker;
+import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
@@ -29,7 +29,7 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen
private MapboxMap mapboxMap;
private MapView mapView;
- private MarkerView marker;
+ private Marker marker;
private MapboxMap.OnMapClickListener mapClickListener = new MapboxMap.OnMapClickListener() {
@Override
@@ -87,9 +87,9 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen
mapboxMap.animateCamera(CameraUpdateFactory.newLatLng(PARIS));
}
- private MarkerView addMarker(MapboxMap mapboxMap) {
+ private Marker addMarker(MapboxMap mapboxMap) {
return mapboxMap.addMarker(
- new MarkerViewOptions()
+ new MarkerOptions()
.position(PARIS)
.icon(IconUtils.drawableToIcon(this, R.drawable.ic_location_city,
ResourcesCompat.getColor(getResources(), R.color.mapbox_blue, getTheme()))
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerView.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerView.java
deleted file mode 100644
index cab03e4f7a..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerView.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.model.annotations;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-
-public class CountryMarkerView extends MarkerView {
-
- private String abbrevName;
- private int flagRes;
-
- public CountryMarkerView(BaseMarkerViewOptions baseMarkerViewOptions, String abbrevName, int flagRes) {
- super(baseMarkerViewOptions);
- this.abbrevName = abbrevName;
- this.flagRes = flagRes;
- }
-
- public String getAbbrevName() {
- return abbrevName;
- }
-
- public int getFlagRes() {
- return flagRes;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java
deleted file mode 100644
index 6602054f47..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.model.annotations;
-
-import android.graphics.Bitmap;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
-import com.mapbox.mapboxsdk.annotations.Icon;
-import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-
-public class CountryMarkerViewOptions extends BaseMarkerViewOptions<CountryMarkerView, CountryMarkerViewOptions> {
-
- private String abbrevName;
- private int flagRes;
-
- public CountryMarkerViewOptions() {
- }
-
- protected CountryMarkerViewOptions(Parcel in) {
- position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
- snippet(in.readString());
- title(in.readString());
- flat(in.readByte() != 0);
- anchor(in.readFloat(), in.readFloat());
- infoWindowAnchor(in.readFloat(), in.readFloat());
- rotation(in.readFloat());
- visible(in.readByte() != 0);
- alpha(in.readFloat());
- if (in.readByte() != 0) {
- // this means we have an icon
- String iconId = in.readString();
- Bitmap iconBitmap = in.readParcelable(Bitmap.class.getClassLoader());
- Icon icon = IconFactory.recreate(iconId, iconBitmap);
- icon(icon);
- }
- abbrevName(in.readString());
- flagRes(in.readInt());
- }
-
- @Override
- public CountryMarkerViewOptions getThis() {
- return this;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeParcelable(getPosition(), flags);
- out.writeString(getSnippet());
- out.writeString(getTitle());
- out.writeByte((byte) (isFlat() ? 1 : 0));
- out.writeFloat(getAnchorU());
- out.writeFloat(getAnchorV());
- out.writeFloat(getInfoWindowAnchorU());
- out.writeFloat(getInfoWindowAnchorV());
- out.writeFloat(getRotation());
- out.writeByte((byte) (isVisible() ? 1 : 0));
- out.writeFloat(getAlpha());
- Icon icon = getIcon();
- out.writeByte((byte) (icon != null ? 1 : 0));
- if (icon != null) {
- out.writeString(getIcon().getId());
- out.writeParcelable(getIcon().getBitmap(), flags);
- }
- out.writeString(abbrevName);
- out.writeInt(flagRes);
- }
-
- @Override
- public CountryMarkerView getMarker() {
- return new CountryMarkerView(this, abbrevName, flagRes);
- }
-
- public CountryMarkerViewOptions abbrevName(String abbrevName) {
- this.abbrevName = abbrevName;
- return getThis();
- }
-
- public CountryMarkerViewOptions flagRes(int flagRes) {
- this.flagRes = flagRes;
- return getThis();
- }
-
- public static final Parcelable.Creator<CountryMarkerViewOptions> CREATOR
- = new Parcelable.Creator<CountryMarkerViewOptions>() {
- public CountryMarkerViewOptions createFromParcel(Parcel in) {
- return new CountryMarkerViewOptions(in);
- }
-
- public CountryMarkerViewOptions[] newArray(int size) {
- return new CountryMarkerViewOptions[size];
- }
- };
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java
deleted file mode 100644
index b01c9907e0..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.model.annotations;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-
-public class PulseMarkerView extends MarkerView {
-
- public PulseMarkerView(BaseMarkerViewOptions baseMarkerViewOptions) {
- super(baseMarkerViewOptions);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java
deleted file mode 100644
index d752e5d0ef..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.model.annotations;
-
-import android.graphics.Bitmap;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
-import com.mapbox.mapboxsdk.annotations.Icon;
-import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-
-public class PulseMarkerViewOptions extends BaseMarkerViewOptions<PulseMarkerView, PulseMarkerViewOptions> {
-
- public PulseMarkerViewOptions() {
- }
-
- protected PulseMarkerViewOptions(Parcel in) {
- position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
- snippet(in.readString());
- title(in.readString());
- flat(in.readByte() != 0);
- anchor(in.readFloat(), in.readFloat());
- selected = in.readByte() != 0;
- rotation(in.readFloat());
- if (in.readByte() != 0) {
- // this means we have an icon
- String iconId = in.readString();
- Bitmap iconBitmap = in.readParcelable(Bitmap.class.getClassLoader());
- Icon icon = IconFactory.recreate(iconId, iconBitmap);
- icon(icon);
- }
- }
-
- @Override
- public PulseMarkerViewOptions getThis() {
- return this;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeParcelable(getPosition(), flags);
- out.writeString(getSnippet());
- out.writeString(getTitle());
- out.writeByte((byte) (isFlat() ? 1 : 0));
- out.writeFloat(getAnchorU());
- out.writeFloat(getAnchorV());
- out.writeFloat(getInfoWindowAnchorU());
- out.writeFloat(getInfoWindowAnchorV());
- out.writeByte((byte) (selected ? 1 : 0));
- out.writeFloat(getRotation());
- Icon icon = getIcon();
- out.writeByte((byte) (icon != null ? 1 : 0));
- if (icon != null) {
- out.writeString(getIcon().getId());
- out.writeParcelable(getIcon().getBitmap(), flags);
- }
- }
-
- @Override
- public PulseMarkerView getMarker() {
- return new PulseMarkerView(this);
- }
-
- public static final Parcelable.Creator<PulseMarkerViewOptions> CREATOR
- = new Parcelable.Creator<PulseMarkerViewOptions>() {
- public PulseMarkerViewOptions createFromParcel(Parcel in) {
- return new PulseMarkerViewOptions(in);
- }
-
- public PulseMarkerViewOptions[] newArray(int size) {
- return new PulseMarkerViewOptions[size];
- }
- };
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java
deleted file mode 100644
index dcee5c2409..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.model.annotations;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
-import com.mapbox.mapboxsdk.annotations.MarkerView;
-
-public class TextMarkerView extends MarkerView {
-
- private String text;
-
- public TextMarkerView(BaseMarkerViewOptions baseMarkerViewOptions, String text) {
- super(baseMarkerViewOptions);
- this.text = text;
- }
-
- public String getText() {
- return text;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java
deleted file mode 100644
index df7c575f74..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerViewOptions.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.model.annotations;
-
-import android.graphics.Bitmap;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
-import com.mapbox.mapboxsdk.annotations.Icon;
-import com.mapbox.mapboxsdk.annotations.IconFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-
-public class TextMarkerViewOptions extends BaseMarkerViewOptions<TextMarkerView, TextMarkerViewOptions> {
-
- private String text;
-
- public TextMarkerViewOptions() {
- }
-
- protected TextMarkerViewOptions(Parcel in) {
- position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
- snippet(in.readString());
- title(in.readString());
- flat(in.readByte() != 0);
- anchor(in.readFloat(), in.readFloat());
- infoWindowAnchor(in.readFloat(), in.readFloat());
- rotation(in.readFloat());
- visible(in.readByte() != 0);
- alpha(in.readFloat());
- if (in.readByte() != 0) {
- // this means we have an icon
- String iconId = in.readString();
- Bitmap iconBitmap = in.readParcelable(Bitmap.class.getClassLoader());
- Icon icon = IconFactory.recreate(iconId, iconBitmap);
- icon(icon);
- }
- text(in.readString());
- }
-
- @Override
- public TextMarkerViewOptions getThis() {
- return this;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeParcelable(getPosition(), flags);
- out.writeString(getSnippet());
- out.writeString(getTitle());
- out.writeByte((byte) (isFlat() ? 1 : 0));
- out.writeFloat(getAnchorU());
- out.writeFloat(getAnchorV());
- out.writeFloat(getInfoWindowAnchorU());
- out.writeFloat(getInfoWindowAnchorV());
- out.writeFloat(getRotation());
- out.writeByte((byte) (isVisible() ? 1 : 0));
- out.writeFloat(alpha);
- Icon icon = getIcon();
- out.writeByte((byte) (icon != null ? 1 : 0));
- if (icon != null) {
- out.writeString(getIcon().getId());
- out.writeParcelable(getIcon().getBitmap(), flags);
- }
- out.writeString(text);
- }
-
- @Override
- public TextMarkerView getMarker() {
- return new TextMarkerView(this, text);
- }
-
- public TextMarkerViewOptions text(String text) {
- this.text = text;
- return getThis();
- }
-
- public static final Parcelable.Creator<CountryMarkerViewOptions> CREATOR
- = new Parcelable.Creator<CountryMarkerViewOptions>() {
- public CountryMarkerViewOptions createFromParcel(Parcel in) {
- return new CountryMarkerViewOptions(in);
- }
-
- public CountryMarkerViewOptions[] newArray(int size) {
- return new CountryMarkerViewOptions[size];
- }
- };
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml
index 52691a26fe..eae79f631d 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_bulk.xml
@@ -15,24 +15,4 @@
app:mapbox_cameraZoom="10"
app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/>
- <TextView
- android:id="@+id/countView"
- android:textIsSelectable="false"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/toolbar"
- android:padding="16dp"
- android:textSize="20sp"/>
-
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/fab"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
- android:layout_gravity="end|bottom"
- android:layout_margin="@dimen/fab_margin"
- android:src="@drawable/ic_animate_coordinates"/>
-
</RelativeLayout>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view.xml
deleted file mode 100644
index dae3a1d9b7..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <com.mapbox.mapboxsdk.maps.MapView
- android:id="@id/mapView"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_below="@id/toolbar"
- android:textIsSelectable="false"
- app:mapbox_cameraTargetLat="38.907192"
- app:mapbox_cameraTargetLng="-77.036871"
- app:mapbox_cameraZoom="12"
- app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/>
-
- <TextView
- android:id="@+id/countView"
- android:textIsSelectable="false"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="16dp"
- android:textSize="20sp"/>
-
-</RelativeLayout>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view_in_rect.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view_in_rect.xml
deleted file mode 100644
index ecda2873ce..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_marker_view_in_rect.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <com.mapbox.mapboxsdk.maps.MapView
- android:id="@+id/mapView"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
-
- <FrameLayout
- android:id="@+id/selection_box"
- android:layout_width="150dp"
- android:layout_height="150dp"
- android:layout_centerInParent="true"
- android:alpha="0.3"
- android:background="@color/mapboxGreen"/>
-
-</RelativeLayout>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml
index 1256e42756..ca54c954d4 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml
@@ -25,7 +25,6 @@
<string name="description_scroll_by">Scroll with pixels in x,y direction</string>
<string name="description_snapshot">Example to make a snapshot of the map</string>
<string name="description_doublemap">2 maps in a view hierarchy</string>
- <string name="description_view_marker">Use an Android SDK View as marker</string>
<string name="description_dynamic_info_window_adapter">Learn how to create a dynamic custom InfoWindow</string>
<string name="description_viewpager">Use SupportMapFragments in a ViewPager</string>
<string name="description_runtime_style">Adopt the map style on the fly</string>
@@ -47,7 +46,6 @@
<string name="description_add_remove_markers">Change Symbol icon when zoom levels changes</string>
<string name="description_style_file">Use a local file as the style</string>
<string name="description_map_in_dialog">Display a map inside a dialog fragment</string>
- <string name="description_marker_view_rectangle">Marker Views within a rectangle</string>
<string name="description_circle_layer">Show bus stops and route in Singapore</string>
<string name="description_url_transform">Transform urls on the fly</string>
<string name="description_restricted_bounds">Limit viewport to Iceland</string>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml
index 2408f7dcdb..f73bcc147d 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml
@@ -9,7 +9,6 @@
<string name="activity_polyline">Polyline</string>
<string name="activity_polygon">Polygon</string>
<string name="activity_press_for_marker">Press Map For Marker</string>
- <string name="activity_view_marker">View Marker API</string>
<string name="activity_add_remove_markers">Zoom function with SymbolLayer</string>
<string name="activity_info_window">Standard InfoWindow</string>
<string name="activity_infowindow_adapter">Custom InfoWindow</string>
@@ -48,7 +47,6 @@
<string name="activity_map_change">Map Change Events</string>
<string name="activity_map_visibility">Visibility Map</string>
<string name="activity_map_in_dialog">Dialog with map</string>
- <string name="activity_marker_view_rectangle">Marker views in rectangle</string>
<string name="activity_url_transform">Url transform</string>
<string name="activity_restricted_bounds">Restrict camera to a bounds</string>
<string name="activity_fill_extrusion_layer">Fill extrusions</string>