aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt11
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt12
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt4
3 files changed, 18 insertions, 9 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt
index dce8ceb..b905beb 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt
@@ -6,19 +6,24 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
+import kotlin.time.ExperimentalTime
import kotlinx.coroutines.DelicateCoroutinesApi
import mx.trackermap.TrackerMap.android.databinding.DevicesFragmentBinding
import mx.trackermap.TrackerMap.android.details.DetailsActivity
import mx.trackermap.TrackerMap.android.shared.UnitRenderData
-import mx.trackermap.TrackerMap.android.units.UnitFragment
import mx.trackermap.TrackerMap.android.units.UnitsViewModel
import mx.trackermap.TrackerMap.client.models.UnitInformation
-import kotlin.time.ExperimentalTime
@DelicateCoroutinesApi
@ExperimentalTime
-class DevicesFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment(unitsViewModel) {
+class DevicesFragment : Fragment() {
+
+ private val unitsViewModel: UnitsViewModel by viewModels(
+ ownerProducer = { requireActivity() }
+ )
private var _binding: DevicesFragmentBinding? = null
private val binding get() = _binding!!
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt
index 3ab25e4..b6396c8 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt
@@ -6,23 +6,27 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import android.widget.Toast
import androidx.core.text.HtmlCompat
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.viewModels
+import kotlin.time.ExperimentalTime
import kotlinx.coroutines.DelicateCoroutinesApi
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitMapFragmentBinding
import mx.trackermap.TrackerMap.android.details.DetailsActivity
import mx.trackermap.TrackerMap.android.shared.MarkerTransformations
import mx.trackermap.TrackerMap.android.shared.UnitRenderData
-import mx.trackermap.TrackerMap.android.units.UnitFragment
import mx.trackermap.TrackerMap.android.units.UnitsViewModel
import mx.trackermap.TrackerMap.client.models.MapLayer
import mx.trackermap.TrackerMap.client.models.UnitInformation
-import kotlin.time.ExperimentalTime
@DelicateCoroutinesApi
@ExperimentalTime
-class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment(unitsViewModel) {
+class UnitMapFragment : Fragment() {
+
+ private val unitsViewModel: UnitsViewModel by viewModels(
+ ownerProducer = { requireActivity() }
+ )
private var _binding: UnitMapFragmentBinding? = null
private val binding get() = _binding!!
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 30e34b3..adc0cb9 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
@@ -32,10 +32,10 @@ class UnitsActivity : AppCompatActivity() {
private val unitsViewModel: UnitsViewModel by viewModel()
private val mapFragment: UnitMapFragment by lazy {
- UnitMapFragment(unitsViewModel)
+ UnitMapFragment()
}
private val devicesFragment: DevicesFragment by lazy {
- DevicesFragment(unitsViewModel)
+ DevicesFragment()
}
override fun onCreate(savedInstanceState: Bundle?) {