kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Merge pull request #94 from geeksville/dev
misc atomic commits - see commit for detailspull/97/head
commit
36e2da4651
1
TODO.md
1
TODO.md
|
@ -37,7 +37,6 @@ the channel is encrypted, you can share the the channel key with others by qr co
|
||||||
* keep past messages in db, one db per channel (currently we just keep an array in saved preferences)
|
* keep past messages in db, one db per channel (currently we just keep an array in saved preferences)
|
||||||
* show user avatars in chat (use the google user info api)
|
* show user avatars in chat (use the google user info api)
|
||||||
* let users save old channels (i.e. have a menu of channels the user can use)
|
* let users save old channels (i.e. have a menu of channels the user can use)
|
||||||
* also add a receiver that fires after a new update was installed from the play store
|
|
||||||
* if the rxpacket queue on the device overflows (because android hasn't connected in a while) send a special packet to android which means 'X packets have been dropped because you were offline' -drop oldest packets first
|
* if the rxpacket queue on the device overflows (because android hasn't connected in a while) send a special packet to android which means 'X packets have been dropped because you were offline' -drop oldest packets first
|
||||||
* make sw update work over BLE
|
* make sw update work over BLE
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<receiver android:name="com.geeksville.mesh.service.BootCompleteReceiver">
|
<receiver android:name="com.geeksville.mesh.service.BootCompleteReceiver">
|
||||||
|
<!-- handle boot events -->
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
|
@ -160,6 +161,15 @@
|
||||||
<!-- for testing -->
|
<!-- for testing -->
|
||||||
<action android:name="com.geeksville.mesh.SIM_BOOT" />
|
<action android:name="com.geeksville.mesh.SIM_BOOT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Also restart our service if the app gets upgraded -->
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
|
<!-- I was using PACKAGE_REPLACED, but MY_PACKAGE_REPLACED is newer and seems cleaner
|
||||||
|
<data
|
||||||
|
android:scheme="package"
|
||||||
|
android:path="com.geeksville.mesh" /> -->
|
||||||
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.lifecycle.Observer
|
||||||
import com.geeksville.android.GeeksvilleApplication
|
import com.geeksville.android.GeeksvilleApplication
|
||||||
import com.geeksville.android.Logging
|
import com.geeksville.android.Logging
|
||||||
import com.geeksville.mesh.NodeInfo
|
import com.geeksville.mesh.NodeInfo
|
||||||
|
@ -130,7 +131,12 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapView: MapView? = null
|
var mapView: MapView? = null
|
||||||
var mapboxMap: MapboxMap? = 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() = view != null && isResumed
|
||||||
|
|
||||||
override fun onViewCreated(viewIn: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(viewIn: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(viewIn, savedInstanceState)
|
super.onViewCreated(viewIn, savedInstanceState)
|
||||||
|
@ -145,7 +151,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
// Each time the pane is shown start fetching new map info (we do this here instead of
|
// Each time the pane is shown start fetching new map info (we do this here instead of
|
||||||
// onCreate because getMapAsync can die in native code if the view goes away)
|
// onCreate because getMapAsync can die in native code if the view goes away)
|
||||||
v.getMapAsync { map ->
|
v.getMapAsync { map ->
|
||||||
mapboxMap = map
|
|
||||||
|
|
||||||
if (view != null) { // it might have gone away by now
|
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 = BitmapFactory.decodeResource(context.resources, R.drawable.ic_twotone_person_pin_24)
|
||||||
|
@ -161,8 +166,20 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
|
|
||||||
//map.uiSettings.isScrollGesturesEnabled = true
|
//map.uiSettings.isScrollGesturesEnabled = true
|
||||||
//map.uiSettings.isZoomGesturesEnabled = true
|
//map.uiSettings.isZoomGesturesEnabled = true
|
||||||
|
|
||||||
|
// Provide initial positions
|
||||||
|
model.nodeDB.nodes.value?.let { nodes ->
|
||||||
|
onNodesChanged(map, nodes.values)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Any times nodes change update our map
|
||||||
|
model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { nodes ->
|
||||||
|
debug("Nodes updated! map visible = $isViewVisible")
|
||||||
|
if (isViewVisible)
|
||||||
|
onNodesChanged(map, nodes.values)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,16 +202,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
mapView?.onResume()
|
mapView?.onResume()
|
||||||
|
|
||||||
// FIXME: for now we just set the node positions when the user pages to the map - because
|
|
||||||
// otherwise we try to update in the background which breaks mapbox native code (when view is not shown
|
|
||||||
mapboxMap?.let { map ->
|
|
||||||
// model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { nodes ->
|
|
||||||
model.nodeDB.nodes.value?.values?.let {
|
|
||||||
onNodesChanged(map, it)
|
|
||||||
}
|
|
||||||
//})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 99dbf61fad087db910be7f74867a8f14aba877a4
|
Subproject commit ab381a83f5380358fa8412a58635e390c3729192
|
Ładowanie…
Reference in New Issue