Merge pull request #450 from andrekir/back-stack

fix back not moving task to background
This commit is contained in:
Andre Kirchhoff 2022-06-21 11:18:40 -03:00 committed by GitHub
commit 121a25ccb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -937,6 +937,14 @@ class MainActivity : BaseActivity(), Logging,
model.meshService = null
}
override fun onBackPressed() { // FIXME Override back button to avoid closing
if (supportFragmentManager.backStackEntryCount == 0) {
moveTaskToBack(false)
} else {
super.onBackPressed()
}
}
override fun onStop() {
unregisterMeshReceiver() // No point in receiving updates while the GUI is gone, we'll get them when the user launches the activity
unbindMeshService()