aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt11
1 files changed, 8 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 d8ced28..e9b9010 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
@@ -153,9 +153,6 @@ class UnitsActivity : AppCompatActivity() {
}
supportFragmentManager.commit {
replace(R.id.displayContainer, newFragment)
- if (displayMode == UnitsViewModel.UnitsDisplayMode.LIST) {
- addToBackStack(null)
- }
setTransition(TRANSIT_FRAGMENT_FADE)
}
}
@@ -168,4 +165,12 @@ class UnitsActivity : AppCompatActivity() {
unitsViewModel.unitsDisplayMode.removeObservers(this)
unitsViewModel.selectedUnit.removeObservers(this)
}
+
+ override fun onBackPressed() {
+ if (unitsViewModel.unitsDisplayMode.value == UnitsViewModel.UnitsDisplayMode.LIST) {
+ unitsViewModel.setDisplayMode(UnitsViewModel.UnitsDisplayMode.MAP)
+ } else {
+ super.onBackPressed()
+ }
+ }
} \ No newline at end of file