Skip to content

Commit

Permalink
Follow mode for OSM
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyDude1994 committed Nov 17, 2020
1 parent b2e907f commit 2e7d680
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class OsmMapWrapper(private val context: Context, private val mapView: MapView)
}

override fun setOnCameraMoveStartedListener(function: () -> Unit) {
mapView.setOnTouchListener { v, event ->
function()
return@setOnTouchListener false
}
}

override fun addPolyline(color: Int): MapLine {
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/crazydude/com/telemetry/ui/MapsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class MapsActivity : AppCompatActivity(), DataDecoder.Listener {
val mapView = org.osmdroid.views.MapView(this)
mapHolder.addView(mapView)
map = OsmMapWrapper(applicationContext, mapView)
map?.isMyLocationEnabled = true
map?.setOnCameraMoveStartedListener {
followMode = false
}
polyLine = map?.addPolyline(preferenceManager.getRouteColor())
showMyLocation()
}
Expand Down

0 comments on commit 2e7d680

Please sign in to comment.