kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
update InfoWindow layout
rodzic
d94620328b
commit
75af1ed197
|
@ -46,8 +46,7 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
private val defaultZoomSpeed = 3000L
|
private val defaultZoomSpeed = 3000L
|
||||||
private val prefsName = "org.andnav.osm.prefs"
|
private val prefsName = "org.andnav.osm.prefs"
|
||||||
private val mapStyleId = "map_style_id"
|
private val mapStyleId = "map_style_id"
|
||||||
private val uiPrefs = "ui-prefs"
|
private var nodePositions = listOf<MarkerWithLabel>()
|
||||||
private var nodePositions = listOf<Marker>()
|
|
||||||
private val nodeLayer = 1
|
private val nodeLayer = 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +116,7 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
* Using the latest nodedb, generate GeoPoint
|
* Using the latest nodedb, generate GeoPoint
|
||||||
*/
|
*/
|
||||||
// Find all nodes with valid locations
|
// Find all nodes with valid locations
|
||||||
fun getCurrentNodes(): List<Marker> {
|
fun getCurrentNodes(): List<MarkerWithLabel> {
|
||||||
val mrkr = nodesWithPosition.map { node ->
|
val mrkr = nodesWithPosition.map { node ->
|
||||||
val p = node.position!!
|
val p = node.position!!
|
||||||
debug("Showing on map: $node")
|
debug("Showing on map: $node")
|
||||||
|
@ -125,11 +124,11 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
node.user?.let {
|
node.user?.let {
|
||||||
val label = it.longName + " " + formatAgo(p.time)
|
val label = it.longName + " " + formatAgo(p.time)
|
||||||
marker = MarkerWithLabel(map, label)
|
marker = MarkerWithLabel(map, label)
|
||||||
marker.title = buildString {
|
marker.title = "${it.longName} ${node.batteryStr}"
|
||||||
append("$label ${node.batteryStr}\n${model.gpsString(p)}")
|
marker.snippet = model.gpsString(p)
|
||||||
model.nodeDB.ourNodeInfo?.let { our ->
|
model.nodeDB.ourNodeInfo?.let { our ->
|
||||||
val dist = our.distanceStr(node)
|
our.distanceStr(node)?.let { dist ->
|
||||||
if (dist != null) append(" (${our.bearing(node)}° $dist)")
|
marker.subDescription = "bearing: ${our.bearing(node)}° distance: $dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
|
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
|
||||||
|
|
Ładowanie…
Reference in New Issue