diff --git a/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt index 77ccb53fb..8544a8db8 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/MapFragment.kt @@ -30,6 +30,7 @@ import com.mapbox.maps.extension.style.layers.properties.generated.TextAnchor import com.mapbox.maps.extension.style.layers.properties.generated.TextJustify import com.mapbox.maps.extension.style.sources.addSource import com.mapbox.maps.extension.style.sources.generated.GeoJsonSource +import com.mapbox.maps.plugin.gestures.gestures class MapFragment : ScreenFragment("Map"), Logging { @@ -165,14 +166,16 @@ class MapFragment : ScreenFragment("Map"), Logging { )!!.toBitmap() map.loadStyleUri(Style.OUTDOORS) { - it.addSource(nodePositions) - it.addImage(markerImageId, markerIcon) - it.addLayer(nodeLayer) - it.addLayer(labelLayer) + if (it.isStyleLoaded) { + it.addSource(nodePositions) + it.addImage(markerImageId, markerIcon) + it.addLayer(nodeLayer) + it.addLayer(labelLayer) + } + } - //TODO setup gesture controls - // map.uiSettings.isRotateGesturesEnabled = false + v.gestures.rotateEnabled = false // Provide initial positions model.nodeDB.nodes.value?.let { nodes -> diff --git a/app/src/main/res/layout/map_view.xml b/app/src/main/res/layout/map_view.xml index 5dda7c296..f65e5453e 100644 --- a/app/src/main/res/layout/map_view.xml +++ b/app/src/main/res/layout/map_view.xml @@ -1,18 +1,10 @@ - - - - - \ No newline at end of file + android:layout_height="match_parent" + mapbox:mapbox_cameraTargetLat="40.7128" + mapbox:mapbox_cameraTargetLng="-74.0060" + mapbox:mapbox_cameraZoom="9.0" /> \ No newline at end of file