aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-17 15:57:21 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-17 15:57:21 -0600
commitc7543adf0d7bc59f7e6cffe8a9dc166a724bf63c (patch)
treec12472290b7a6b0795fcfb6adc0b8ed9186e166d
parentb1c3775dbade0bcb9ada928435cd93f3c69cffe8 (diff)
downloadetbsa-trackermap-mobile-c7543adf0d7bc59f7e6cffe8a9dc166a724bf63c.tar.gz
etbsa-trackermap-mobile-c7543adf0d7bc59f7e6cffe8a9dc166a724bf63c.tar.bz2
etbsa-trackermap-mobile-c7543adf0d7bc59f7e6cffe8a9dc166a724bf63c.zip
Fixed geofences retrieval on reports fragment
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt3
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsViewModel.kt2
2 files changed, 4 insertions, 1 deletions
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<Geofence>) {
+ 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<ReportDates.ReportPeriod> =
savedStateHandle.getLiveData("reportPeriod", null)
private val _report: MutableLiveData<ReportController.Report> = MutableLiveData()
- private val _geofences: MutableLiveData<Array<Geofence>> = MutableLiveData()
+ private val _geofences: MutableLiveData<Array<Geofence>> = MutableLiveData(emptyArray())
val deviceId: LiveData<Int> get() = _deviceId
val reportType: LiveData<ReportController.ReportType> get() = _reportType