aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp/src/main')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt1
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt4
2 files changed, 5 insertions, 0 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
index 4371eed..a327234 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
@@ -78,6 +78,7 @@ class UnitsActivity : AppCompatActivity() {
override fun onDestroy() {
super.onDestroy()
_binding = null
+ unitsViewModel.stopUpdates()
}
private fun setupViews() {
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt
index d7b6db1..8401ee7 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt
@@ -90,6 +90,10 @@ class UnitsViewModel(
}
}
+ fun stopUpdates() {
+ unitsController.stopUpdates()
+ }
+
fun selectUnit(unit: UnitInformation) {
Log.d("UnitsViewModel", "Selecting unit ${unit.device.name}")
_selectedUnit.postValue(unit)