diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-17 00:58:01 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-17 00:58:01 -0600 |
commit | a47e129ad8671bc8699a67e15f0aeb6c2c8b63bb (patch) | |
tree | 8112d54a2f62addc5d09b4d5e729b8063a9c7289 | |
parent | f8a4f5e6ab88439325aaf05fd9ff0427ed4ecfb8 (diff) | |
download | etbsa-trackermap-mobile-a47e129ad8671bc8699a67e15f0aeb6c2c8b63bb.tar.gz etbsa-trackermap-mobile-a47e129ad8671bc8699a67e15f0aeb6c2c8b63bb.tar.bz2 etbsa-trackermap-mobile-a47e129ad8671bc8699a67e15f0aeb6c2c8b63bb.zip |
If display mode is list, back button returns to map
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt | 11 |
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 |