sforkowany z mirror/meshtastic-android
fix: removeObservers when onStop is called (UI not visible)
rodzic
7fedc2b0e1
commit
09662c0141
|
@ -210,10 +210,6 @@ class MainActivity : AppCompatActivity(), Logging {
|
||||||
tab.icon = ContextCompat.getDrawable(this, tabInfos[position].icon)
|
tab.icon = ContextCompat.getDrawable(this, tabInfos[position].icon)
|
||||||
}.attach()
|
}.attach()
|
||||||
|
|
||||||
model.connectionState.observe(this) { connected ->
|
|
||||||
updateConnectionStatusImage(connected)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle any intent
|
// Handle any intent
|
||||||
handleIntent(intent)
|
handleIntent(intent)
|
||||||
}
|
}
|
||||||
|
@ -638,6 +634,11 @@ class MainActivity : AppCompatActivity(), Logging {
|
||||||
unregisterMeshReceiver() // No point in receiving updates while the GUI is gone, we'll get them when the user launches the activity
|
unregisterMeshReceiver() // No point in receiving updates while the GUI is gone, we'll get them when the user launches the activity
|
||||||
unbindMeshService()
|
unbindMeshService()
|
||||||
|
|
||||||
|
scanModel.changeDeviceAddress.removeObservers(this)
|
||||||
|
model.connectionState.removeObservers(this)
|
||||||
|
bluetoothViewModel.enabled.removeObservers(this)
|
||||||
|
model.requestChannelUrl.removeObservers(this)
|
||||||
|
|
||||||
super.onStop()
|
super.onStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,6 +659,10 @@ class MainActivity : AppCompatActivity(), Logging {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model.connectionState.observe(this) { connected ->
|
||||||
|
updateConnectionStatusImage(connected)
|
||||||
|
}
|
||||||
|
|
||||||
bluetoothViewModel.enabled.observe(this) { enabled ->
|
bluetoothViewModel.enabled.observe(this) { enabled ->
|
||||||
if (!enabled && !requestedEnable && scanModel.selectedBluetooth) {
|
if (!enabled && !requestedEnable && scanModel.selectedBluetooth) {
|
||||||
requestedEnable = true
|
requestedEnable = true
|
||||||
|
|
Ładowanie…
Reference in New Issue