aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units
diff options
context:
space:
mode:
authorIsidro Henoch <imhenoch@protonmail.com>2022-01-12 18:05:18 -0600
committerIsidro Henoch <imhenoch@protonmail.com>2022-01-12 18:05:18 -0600
commit270e54f2d83a962a33646c47917d8ea00a282bd9 (patch)
tree5f079f972dc53162445ac6a1a5f63d397431e4a2 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/units
parentcc7cfcb2d65a1164f5b75ae4292ea9a099746038 (diff)
downloadetbsa-trackermap-mobile-270e54f2d83a962a33646c47917d8ea00a282bd9.tar.gz
etbsa-trackermap-mobile-270e54f2d83a962a33646c47917d8ea00a282bd9.tar.bz2
etbsa-trackermap-mobile-270e54f2d83a962a33646c47917d8ea00a282bd9.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')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitFragment.kt8
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt11
2 files changed, 16 insertions, 3 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitFragment.kt
new file mode 100644
index 0000000..ab3afc1
--- /dev/null
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitFragment.kt
@@ -0,0 +1,8 @@
+package mx.trackermap.TrackerMap.android.units
+
+import androidx.fragment.app.Fragment
+import kotlinx.coroutines.DelicateCoroutinesApi
+
+open class UnitFragment @DelicateCoroutinesApi constructor(
+ private val unitsViewModel: UnitsViewModel
+) : Fragment() \ No newline at end of file
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)