[android] shutting down thread pool of the CustomGeometrySource when the source is destroyed

This commit is contained in:
Łukasz Paczos
2018-07-31 19:42:09 +02:00
committed by Łukasz Paczos
parent b500577bfa
commit 63d4ac05f2
8 changed files with 198 additions and 26 deletions

View File

@@ -30,12 +30,16 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.lineColor;
*/
public class GridSourceActivity extends AppCompatActivity implements OnMapReadyCallback {
private static final String ID_GRID_SOURCE = "grid_source";
private static final String ID_GRID_LAYER = "grid_layer";
public static final String ID_GRID_SOURCE = "grid_source";
public static final String ID_GRID_LAYER = "grid_layer";
private MapView mapView;
private MapboxMap mapboxMap;
// public for testing purposes
public CustomGeometrySource source;
public LineLayer layer;
/**
* Implementation of GeometryTileProvider that returns features representing a zoom-dependent
* grid.
@@ -101,11 +105,11 @@ public class GridSourceActivity extends AppCompatActivity implements OnMapReadyC
mapboxMap = map;
// add source
CustomGeometrySource source = new CustomGeometrySource(ID_GRID_SOURCE, new GridProvider());
source = new CustomGeometrySource(ID_GRID_SOURCE, new GridProvider());
mapboxMap.addSource(source);
// add layer
LineLayer layer = new LineLayer(ID_GRID_LAYER, ID_GRID_SOURCE);
layer = new LineLayer(ID_GRID_LAYER, ID_GRID_SOURCE);
layer.setProperties(
lineColor(Color.parseColor("#000000"))
);