Я нашел ответ.
val dateValidator: CalendarConstraints.DateValidator = DateValidatorPointForward.now()
val builder = MaterialDatePicker.Builder.dateRangePicker()
val constraintsBuilder =
CalendarConstraints.Builder().setStart(calendar.timeInMillis)
.setOpenAt((selectedStartDate ?: calendar.timeInMillis))
.setValidator(dateValidator).build()
val picker = builder
.setTitleText(getText(R.string.select_start_date_and_end_date))
.setSelection(
Pair(
(selectedStartDate ?: calendar.timeInMillis),
(selectedEndDate ?: calendar.timeInMillis)
)
)
.setTheme(AppUtils.resolveOrThrow(requireContext(), R.attr.materialCalendarTheme))
.setInputMode(MaterialDatePicker.INPUT_MODE_CALENDAR)
.setCalendarConstraints(constraintsBuilder)
.build()
picker.show(parentFragmentManager, picker.toString())
picker.addOnPositiveButtonClickListener {
selectedStartDate = it.first ?: 0
selectedEndDate = it.second ?: 0
setStartAndEndDate(selectedStartDate, selectedEndDate)
}
- Был метод openAt (). Спасибо.