PrimeDatePicker
PrimeDatePicker copied to clipboard
Switch do endDay after chosen startDay in PrimeMonthView or PrimeCalendarView
When I use PrimeMonthView or PrimeCalendarView as standalone component I only can get the startDay on touching it.
I set pickType attribute to PickType.RANGE_START and the callback onDayPickedListener returns only the startDay, i.e, selecting other days only changes the startDay.
If I set pickType to PickType.RANGE_ENDnothing happens.
Is it possible to switch to endDay after chosen the startDay?
If you change the pickType to PickType.RANGE_END it should change the picking type as everything in this library works based on that. In order to switch to PickType.RANGE_END automatically, you just need to have something like this:
override fun onDayPicked(
pickType: PickType,
singleDay: PrimeCalendar?,
startDay: PrimeCalendar?,
endDay: PrimeCalendar?,
multipleDays: List<PrimeCalendar>
) {
when (pickType) {
PickType.RANGE_START -> {
if (endDay == null) {
calendarView.pickType = PickType.RANGE_END
}
}
// ...
}
}
It has been implemented in PrimeDatePickerImpl to handle auto-switching for the dialog/bottomsheet date pickers.