From 92ab928f9efd238be7232ee4ec5962bfbb5a0e12 Mon Sep 17 00:00:00 2001 From: Isidro Henoch Date: Mon, 31 Jan 2022 17:42:26 -0600 Subject: Tries to fix the units update issue --- .../main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt | 1 + .../java/mx/trackermap/TrackerMap/android/units/UnitsViewModel.kt | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'androidApp') 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) -- cgit v1.2.3