aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt14
1 files changed, 12 insertions, 2 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 9fcef7f..58147e4 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
@@ -66,6 +66,10 @@ class UnitsActivity : AppCompatActivity() {
}
private fun setupViews() {
+ supportFragmentManager.commit {
+ add(R.id.displayContainer, mapFragment)
+ add(R.id.displayContainer, devicesFragment)
+ }
TooltipCompat.setTooltipText(binding.userButton, getString(R.string.open_profile))
TooltipCompat.setTooltipText(binding.mapLayerToggle, getString(R.string.switch_layer))
}
@@ -148,9 +152,15 @@ class UnitsActivity : AppCompatActivity() {
UnitsViewModel.UnitsDisplayMode.MAP -> mapFragment
else -> mapFragment
}
+ val oldFragment =
+ when (displayMode) {
+ UnitsViewModel.UnitsDisplayMode.LIST -> mapFragment
+ UnitsViewModel.UnitsDisplayMode.MAP -> devicesFragment
+ else -> devicesFragment
+ }
supportFragmentManager.commit {
- replace(R.id.displayContainer, newFragment)
- setTransition(TRANSIT_FRAGMENT_FADE)
+ show(newFragment)
+ hide(oldFragment)
}
}
unitsViewModel.selectedUnit.observe(this) {