aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt18
1 files changed, 15 insertions, 3 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 e198ce0..5213577 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
@@ -3,8 +3,6 @@ package mx.trackermap.TrackerMap.android.units
import android.content.Intent
import android.os.Bundle
import android.util.Log
-import android.view.Gravity
-import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.commit
@@ -13,7 +11,6 @@ import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitsActivityBinding
import mx.trackermap.TrackerMap.android.devices.DevicesFragment
import mx.trackermap.TrackerMap.android.map.UnitMapFragment
-import mx.trackermap.TrackerMap.android.session.LoginActivity
import mx.trackermap.TrackerMap.android.session.UserInformationActivity
import org.koin.androidx.viewmodel.ext.android.viewModel
@@ -38,9 +35,20 @@ class UnitsActivity : AppCompatActivity() {
setContentView(binding.root)
setupEvents()
+ }
+
+ override fun onResume() {
+ super.onResume()
+
setupObservers()
}
+ override fun onPause() {
+ super.onPause()
+
+ removeObservers()
+ }
+
override fun onDestroy() {
super.onDestroy()
_binding = null
@@ -87,4 +95,8 @@ class UnitsActivity : AppCompatActivity() {
}
}
}
+
+ private fun removeObservers() {
+ unitsViewModel.unitsDisplayMode.removeObservers(this)
+ }
} \ No newline at end of file