MarkerView more robust when updates are asynchronous (#6717)

* [android] - remove ViewMarkers crash, show correct view cache size in test activity

* use MapboxMap to indicate a MarkerView is no longer added on a map, no future updates will be passed on to core.

* resolve memory leak
This commit is contained in:
Tobrun
2016-10-17 14:50:09 +02:00
committed by GitHub
parent b3468f5db7
commit bda0e94af2
3 changed files with 21 additions and 19 deletions

View File

@@ -146,7 +146,7 @@ public class MarkerViewActivity extends AppCompatActivity {
public void onMapChanged(@MapView.MapChange int change) {
if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) {
if (!markerViewManager.getMarkerViewAdapters().isEmpty() && viewCountView != null) {
viewCountView.setText("ViewCache size " + (mapView.getChildCount() - 5));
viewCountView.setText("ViewCache size " + mapView.getMarkerViewContainer().getChildCount());
}
}
}
@@ -194,6 +194,7 @@ public class MarkerViewActivity extends AppCompatActivity {
protected void onStop() {
super.onStop();
locationUpdateHandler.removeCallbacks(moveMarkerRunnable);
rotateUpdateHandler.removeCallbacks(rotateMarkerRunnable);
}
/**