mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-04 22:23:47 -04:00
add back a fixed isViewVisible, @vfurman-gh would you mind reviewing?
This commit is contained in:
@@ -134,6 +134,12 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||
|
||||
var mapView: MapView? = null
|
||||
|
||||
/**
|
||||
* Mapbox native code can crash painfully if you ever call a mapbox view function while the view is not actively being show
|
||||
*/
|
||||
private val isViewVisible: Boolean
|
||||
get() = !(mapView?.isDestroyed ?: true)
|
||||
|
||||
override fun onViewCreated(viewIn: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(viewIn, savedInstanceState)
|
||||
|
||||
@@ -169,7 +175,8 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||
|
||||
// Any times nodes change update our map
|
||||
model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { nodes ->
|
||||
onNodesChanged(map, nodes.values)
|
||||
if(isViewVisible)
|
||||
onNodesChanged(map, nodes.values)
|
||||
})
|
||||
zoomToNodes(map)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user