From 07d184c408aba980f331ecaa3e4baef80b6ce82c Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Mon, 17 Jan 2022 15:57:21 -0600 Subject: Fixed geofences retrieval on reports fragment --- .../TrackerMap/android/details/reports/UnitReportsFragment.kt | 3 +++ .../TrackerMap/android/details/reports/UnitReportsViewModel.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap') diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt index 1f1bb15..e1a24ec 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt @@ -128,6 +128,7 @@ class UnitReportsFragment : Fragment() { when (report) { is ReportController.Report.PositionsReport -> { display(report.positions) + display(unitReportsViewModel.geofences.value!!) showMap(true) } is ReportController.Report.EventsReport -> { @@ -136,6 +137,7 @@ class UnitReportsFragment : Fragment() { } is ReportController.Report.StopsReport -> { display(report.stops) + display(unitReportsViewModel.geofences.value!!) showMap(true) } is ReportController.Report.XlsxReport -> { @@ -301,6 +303,7 @@ class UnitReportsFragment : Fragment() { } private fun display(geofences: Array) { + Log.d("UnitReportsFragment", "Geofences: $geofences") if (reportsMapFragment.hasStarted) { Log.d("UnitReportsFragment", "Displaying geofences: $geofences") reportsMapFragment.displayGeofences(geofences) diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt index a957435..7d1e028 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt @@ -25,7 +25,7 @@ class UnitReportsViewModel( private val _reportPeriod: MutableLiveData = savedStateHandle.getLiveData("reportPeriod", null) private val _report: MutableLiveData = MutableLiveData() - private val _geofences: MutableLiveData> = MutableLiveData() + private val _geofences: MutableLiveData> = MutableLiveData(emptyArray()) val deviceId: LiveData get() = _deviceId val reportType: LiveData get() = _reportType -- cgit v1.2.3