diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-17 13:53:21 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2022-01-17 14:18:10 -0600 |
commit | 76747c473656ecc4f63f28212326f90dc1e53643 (patch) | |
tree | a0d891a3455520805b3bfe8fb051a5ab41890bc2 /androidApp/src/main/java/mx/trackermap/TrackerMap | |
parent | 9cde1ebda80ed802121597421b2286e58fcb4b1d (diff) | |
download | etbsa-trackermap-mobile-76747c473656ecc4f63f28212326f90dc1e53643.tar.gz etbsa-trackermap-mobile-76747c473656ecc4f63f28212326f90dc1e53643.tar.bz2 etbsa-trackermap-mobile-76747c473656ecc4f63f28212326f90dc1e53643.zip |
Little update to some fragments constructor
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap')
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?) { |