aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-17 00:58:01 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-17 00:58:01 -0600
commit6858de4bf2ba110abc29078194135d971ce71aa5 (patch)
tree8112d54a2f62addc5d09b4d5e729b8063a9c7289 /androidApp/src/main
parent7c90f36e21e6d1400990427b3c4eabd4a83d5e9a (diff)
downloadetbsa-trackermap-mobile-6858de4bf2ba110abc29078194135d971ce71aa5.tar.gz
etbsa-trackermap-mobile-6858de4bf2ba110abc29078194135d971ce71aa5.tar.bz2
etbsa-trackermap-mobile-6858de4bf2ba110abc29078194135d971ce71aa5.zip
If display mode is list, back button returns to map
Diffstat (limited to 'androidApp/src/main')
-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