From fc04805bc051f88b16b4f50bff2efc081dc1f387 Mon Sep 17 00:00:00 2001 From: malinajirka Date: Thu, 10 Dec 2020 12:29:07 +0100 Subject: [PATCH 1/7] Disable future dates in date range picker --- .../ui/activitylog/list/ActivityLogListFragment.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListFragment.kt index de77d4996aec..a180a7fbb8aa 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListFragment.kt @@ -10,6 +10,8 @@ import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.google.android.material.datepicker.CalendarConstraints +import com.google.android.material.datepicker.DateValidatorPointBackward import com.google.android.material.datepicker.MaterialDatePicker import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.activity_log_list_fragment.* @@ -174,6 +176,12 @@ class ActivityLogListFragment : Fragment() { private fun showDateRangePicker(initialDateRange: DateRange?) { val picker = MaterialDatePicker.Builder .dateRangePicker() + .setCalendarConstraints( + CalendarConstraints.Builder() + .setValidator(DateValidatorPointBackward.now()) + .setEnd(MaterialDatePicker.todayInUtcMilliseconds()) + .build() + ) .setSelection(initialDateRange) .build() initDateRangePickerButtonClickListener(picker) From c4cbe5092137ff8aac4144cc70f4dc117cab47c2 Mon Sep 17 00:00:00 2001 From: malinajirka Date: Thu, 10 Dec 2020 12:33:42 +0100 Subject: [PATCH 2/7] Update calendar styles --- WordPress/src/main/res/values/styles.xml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/res/values/styles.xml b/WordPress/src/main/res/values/styles.xml index a6363b30fca2..9fc29fc19088 100644 --- a/WordPress/src/main/res/values/styles.xml +++ b/WordPress/src/main/res/values/styles.xml @@ -100,9 +100,6 @@ @style/WordPress.MaterialCalendarTheme - - + + @@ -143,6 +149,18 @@ ?attr/colorOnSurface + + + + + +