[android] #4335 - add clear method for removing annotations to MapboxMap
This commit is contained in:
@@ -159,7 +159,7 @@ public class PolylineActivity extends AppCompatActivity {
|
||||
case R.id.action_id_remove:
|
||||
// test to remove all annotations
|
||||
mPolylineOptions.clear();
|
||||
mMapboxMap.removeAnnotations();
|
||||
mMapboxMap.clear();
|
||||
return true;
|
||||
|
||||
case android.R.id.home:
|
||||
|
||||
@@ -751,6 +751,18 @@ public class MapboxMapTest {
|
||||
assertTrue("Annotations should be empty", mMapboxMap.getAnnotations().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClear() {
|
||||
List<MarkerOptions> markerList = new ArrayList<>();
|
||||
MarkerOptions markerOptions1 = new MarkerOptions().title("a");
|
||||
MarkerOptions markerOptions2 = new MarkerOptions().title("b");
|
||||
markerList.add(markerOptions1);
|
||||
markerList.add(markerOptions2);
|
||||
mMapboxMap.addMarkers(markerList);
|
||||
mMapboxMap.clear();
|
||||
assertTrue("Annotations should be empty", mMapboxMap.getAnnotations().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveAnnotationsByList() {
|
||||
List<MarkerOptions> markerList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user