[android] #3276 - remove annotations was not calling removeMarkerView
This commit is contained in:
@@ -1021,6 +1021,7 @@ public class MapboxMap {
|
||||
annotation = mAnnotations.get(ids[i]);
|
||||
if (annotation instanceof Marker) {
|
||||
((Marker) annotation).hideInfoWindow();
|
||||
removeMarkerView(annotation.getId());
|
||||
}
|
||||
}
|
||||
mMapView.removeAnnotations(ids);
|
||||
|
||||
@@ -16,7 +16,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -27,7 +26,6 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarker;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
|
||||
@@ -65,8 +63,6 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
|
||||
public void onMapReady(@NonNull MapboxMap mapboxMap) {
|
||||
mMapboxMap = mapboxMap;
|
||||
|
||||
mMapboxMap.setMarkerViewAdapter(new TextAdapter(BulkMarkerActivity.this));
|
||||
|
||||
if (actionBar != null) {
|
||||
ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.bulk_marker_list, android.R.layout.simple_spinner_item);
|
||||
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
@@ -76,9 +72,22 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final View fab = findViewById(R.id.fab);
|
||||
if (fab != null) {
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mMapboxMap != null) {
|
||||
fab.animate().alpha(0).start();
|
||||
mMapboxMap.setMarkerViewAdapter(new TextAdapter(BulkMarkerActivity.this));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static class TextAdapter implements MapboxMap.MarkerViewAdapter<Marker> {
|
||||
public static class TextAdapter implements MapboxMap.MarkerViewAdapter<Marker> {
|
||||
|
||||
private LayoutInflater inflater;
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:id="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/primary"
|
||||
@@ -20,12 +19,26 @@
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:center_latitude="38.87031"
|
||||
android:layout_below="@id/toolbar"
|
||||
app:center_longitude="-77.00897"
|
||||
app:style_url="@string/style_mapbox_streets"
|
||||
app:zoom="10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<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"
|
||||
app:backgroundTint="@android:color/white" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
Reference in New Issue
Block a user