mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-02-02 03:42:26 -05:00
Added layers to map, got gestures working
This commit is contained in:
@@ -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 ->
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mapbox.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/mapFrame"
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"> <!-- tab layout requires a unique ID -->
|
||||
|
||||
<com.mapbox.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
mapbox:mapbox_uiScrollGestures="true"
|
||||
mapbox:mapbox_uiZoomGestures="true"></com.mapbox.maps.MapView>
|
||||
|
||||
</FrameLayout>
|
||||
android:layout_height="match_parent"
|
||||
mapbox:mapbox_cameraTargetLat="40.7128"
|
||||
mapbox:mapbox_cameraTargetLng="-74.0060"
|
||||
mapbox:mapbox_cameraZoom="9.0" />
|
||||
Reference in New Issue
Block a user