From 74bb32cba48a5278add7fb0ed555914633a613d3 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Wed, 13 Apr 2022 19:14:27 -0500 Subject: - [android] Set maxDate in date pickers for custom reports --- .../TrackerMap/android/details/reports/UnitReportsFragment.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'androidApp/src/main/java/mx/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 03a4220..21fc62e 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 @@ -261,6 +261,7 @@ class UnitReportsFragment : Fragment() { fromPickedDatetime = LocalDateTime(p1, p2, p3, from.hour, from.minute) fromTimePicker.show() }, from.year, from.monthNumber, from.dayOfMonth) + fromDatePicker.datePicker.maxDate = Calendar.getInstance().timeInMillis fromTimePicker = TimePickerDialog(requireContext(), { p0, p1, p2 -> fromPickedDatetime = LocalDateTime( @@ -278,6 +279,7 @@ class UnitReportsFragment : Fragment() { toPickedDatetime = LocalDateTime(p1, p2, p3, from.hour, from.minute) toTimePicker.show() }, to.year, to.monthNumber, to.dayOfMonth) + toDatePicker.datePicker.maxDate = Calendar.getInstance().timeInMillis toTimePicker = TimePickerDialog(requireContext(), { p0, p1, p2 -> toPickedDatetime = LocalDateTime( @@ -290,6 +292,7 @@ class UnitReportsFragment : Fragment() { unitReportsViewModel.setReportPeriod(it.withFrom(fromPickedDatetime)) } }, to.hour, to.minute, false) + } unitReportsViewModel.geofences.observe(viewLifecycleOwner) { geofences -> -- cgit v1.2.3