Samples: add theme.dispose

This commit is contained in:
Emux
2020-12-28 11:56:32 +02:00
parent d006ba5361
commit d446a3448b

View File

@@ -28,6 +28,8 @@ import org.oscim.renderer.GLViewport;
import org.oscim.scalebar.DefaultMapScaleBar; import org.oscim.scalebar.DefaultMapScaleBar;
import org.oscim.scalebar.MapScaleBar; import org.oscim.scalebar.MapScaleBar;
import org.oscim.scalebar.MapScaleBarLayer; import org.oscim.scalebar.MapScaleBarLayer;
import org.oscim.theme.IRenderTheme;
import org.oscim.theme.ThemeLoader;
import org.oscim.theme.VtmThemes; import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.mapfile.MapFileTileSource; import org.oscim.tiling.source.mapfile.MapFileTileSource;
@@ -44,6 +46,7 @@ public class GettingStarted extends Activity {
private static final int SELECT_MAP_FILE = 0; private static final int SELECT_MAP_FILE = 0;
private MapView mapView; private MapView mapView;
private IRenderTheme theme;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@@ -87,7 +90,8 @@ public class GettingStarted extends Activity {
mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer)); mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer));
// Render theme // Render theme
mapView.map().setTheme(VtmThemes.DEFAULT); theme = ThemeLoader.load(VtmThemes.DEFAULT);
mapView.map().setTheme(theme);
// Scale bar // Scale bar
MapScaleBar mapScaleBar = new DefaultMapScaleBar(mapView.map()); MapScaleBar mapScaleBar = new DefaultMapScaleBar(mapView.map());
@@ -120,6 +124,7 @@ public class GettingStarted extends Activity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
theme.dispose();
mapView.onDestroy(); mapView.onDestroy();
super.onDestroy(); super.onDestroy();
} }