diff options
author | Isidro Henoch <imhenoch@protonmail.com> | 2021-12-08 04:28:51 -0600 |
---|---|---|
committer | Isidro Henoch <imhenoch@protonmail.com> | 2021-12-08 04:28:51 -0600 |
commit | 04c2889895483f5925c90ed7a856d38391fcab45 (patch) | |
tree | 896334a1d8a0540b9d54c7390db2d78e61cadb1b /androidApp/src/main/java/mx/trackermap/TrackerMap/android/map | |
parent | d2ee6a21355c390a4aaefc6ea847060c8e47c6ae (diff) | |
download | etbsa-trackermap-mobile-04c2889895483f5925c90ed7a856d38391fcab45.tar.gz etbsa-trackermap-mobile-04c2889895483f5925c90ed7a856d38391fcab45.tar.bz2 etbsa-trackermap-mobile-04c2889895483f5925c90ed7a856d38391fcab45.zip |
WIP: Implements the basic structure for the units list/map
- Updates the Devices and Positions APIs to properly construct the Url's query when there are null values
- Adds a units controller to the shared module
- Adds a devices and map fragment that each print the fetched units on the console
- Adds a units view model to connect previously mentioned fragments with the units controller
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/map')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt index 0d4d91a..2ffaa2c 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt @@ -1,16 +1,22 @@ package mx.trackermap.TrackerMap.android.map import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment +import kotlinx.coroutines.DelicateCoroutinesApi import mx.trackermap.TrackerMap.android.databinding.MapFragmentBinding +import mx.trackermap.TrackerMap.android.units.UnitsViewModel +import org.koin.androidx.viewmodel.ext.android.viewModel class MapFragment: Fragment() { private var _binding: MapFragmentBinding? = null private val binding get() = _binding!! + private val unitsViewModel: UnitsViewModel by viewModel() + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -24,4 +30,17 @@ class MapFragment: Fragment() { super.onDestroyView() _binding = null } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + setupObservers() + } + + @DelicateCoroutinesApi + private fun setupObservers() { + unitsViewModel.units.observe(this) { units -> + Log.d("MapFragment", "Success $units") + } + } }
\ No newline at end of file |