diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-12 18:05:18 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-12 18:05:18 -0600 |
commit | 88972a0e0d42c355fbed65d7ada3bcbdaad76287 (patch) | |
tree | 5f079f972dc53162445ac6a1a5f63d397431e4a2 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt | |
parent | 9424b6b94d36f0f538576399b949884f6db29ac2 (diff) | |
download | etbsa-trackermap-mobile-88972a0e0d42c355fbed65d7ada3bcbdaad76287.tar.gz etbsa-trackermap-mobile-88972a0e0d42c355fbed65d7ada3bcbdaad76287.tar.bz2 etbsa-trackermap-mobile-88972a0e0d42c355fbed65d7ada3bcbdaad76287.zip |
Fixes issues
- Fixes the logout problem that don't let users sign in again
- Fixes the search bug
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.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 7e5f162..e198ce0 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 @@ -24,6 +24,12 @@ class UnitsActivity : AppCompatActivity() { private val binding get() = _binding!! private val unitsViewModel: UnitsViewModel by viewModel() + private val mapFragment: UnitMapFragment by lazy { + UnitMapFragment(unitsViewModel) + } + private val devicesFragment: DevicesFragment by lazy { + DevicesFragment(unitsViewModel) + } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -73,9 +79,8 @@ class UnitsActivity : AppCompatActivity() { val newFragment = when (displayMode) { - UnitsViewModel.UnitsDisplayMode.LIST -> DevicesFragment() - UnitsViewModel.UnitsDisplayMode.MAP -> UnitMapFragment() - else -> DevicesFragment() + UnitsViewModel.UnitsDisplayMode.LIST -> devicesFragment + UnitsViewModel.UnitsDisplayMode.MAP -> mapFragment } supportFragmentManager.commit { replace(R.id.displayContainer, newFragment) |