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 | 58ac7a17e76016fd2a257605c47cf5705f90c6e1 (patch) | |
tree | a0d891a3455520805b3bfe8fb051a5ab41890bc2 /androidApp/src/main | |
parent | 63217c9b730dd044477da65ceeb8b2551e064577 (diff) | |
download | etbsa-trackermap-mobile-58ac7a17e76016fd2a257605c47cf5705f90c6e1.tar.gz etbsa-trackermap-mobile-58ac7a17e76016fd2a257605c47cf5705f90c6e1.tar.bz2 etbsa-trackermap-mobile-58ac7a17e76016fd2a257605c47cf5705f90c6e1.zip |
Little update to some fragments constructor
Diffstat (limited to 'androidApp/src/main')
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?) { |