Created
January 6, 2019 09:02
-
-
Save mizutori/49696e75f9bb30bb3e1c0d846a65cb30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun addPolyline() { | |
locationService?.locationList?.let{locationList -> | |
runningPathPolyline?.let{ | |
val toLocation = locationList[locationList.size - 1] | |
val to = LatLng( | |
toLocation.latitude, | |
toLocation.longitude | |
) | |
val points = it.points | |
points.add(to) | |
it.points = points | |
} ?: run{ | |
if (locationList.size > 1) { | |
val fromLocation = locationList[locationList.size - 2] | |
val toLocation = locationList[locationList.size - 1] | |
val from = LatLng( | |
fromLocation.latitude, | |
fromLocation.longitude | |
) | |
val to = LatLng( | |
toLocation.latitude, | |
toLocation.longitude | |
) | |
this.runningPathPolyline = map.addPolyline( | |
PolylineOptions() | |
.add(from, to) | |
.width(polylineWidth.toFloat()).color(Color.parseColor("#801B60FE")).geodesic(true) | |
) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment