show coordinates with geo url to open in other mapping app

This commit is contained in:
goga 2021-03-16 10:04:01 +05:00
parent 53745ca9f5
commit 452bf6f6cb
5 changed files with 25 additions and 17 deletions

View file

@ -80,7 +80,7 @@ class MapFragment : ScreenFragment("Map"), Logging {
)
)
node.user?.let {
f.addStringProperty("name", it.longName + " " + formatAgo(node.lastSeen))
f.addStringProperty("name", it.longName + " " + formatAgo(p.time))
}
f
}
@ -94,7 +94,8 @@ class MapFragment : ScreenFragment("Map"), Logging {
}
fun zoomToNodes(map: MapboxMap) {
val nodesWithPosition = model.nodeDB.nodes.value?.values?.filter { it.validPosition != null }
val nodesWithPosition =
model.nodeDB.nodes.value?.values?.filter { it.validPosition != null }
if (nodesWithPosition != null && nodesWithPosition.isNotEmpty()) {
val update = if (nodesWithPosition.size >= 2) {
// Multiple nodes, make them all fit on the map view
@ -159,7 +160,10 @@ class MapFragment : ScreenFragment("Map"), Logging {
if (view != null) { // it might have gone away by now
// val markerIcon = BitmapFactory.decodeResource(context.resources, R.drawable.ic_twotone_person_pin_24)
val markerIcon =
ContextCompat.getDrawable(requireActivity(), R.drawable.ic_twotone_person_pin_24)!!
ContextCompat.getDrawable(
requireActivity(),
R.drawable.ic_twotone_person_pin_24
)!!
map.setStyle(Style.OUTDOORS) { style ->
style.addSource(nodePositions)
@ -177,7 +181,7 @@ class MapFragment : ScreenFragment("Map"), Logging {
// Any times nodes change update our map
model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { nodes ->
if(isViewVisible)
if (isViewVisible)
onNodesChanged(map, nodes.values)
})
zoomToNodes(map)