Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch do endDay after chosen startDay in PrimeMonthView or PrimeCalendarView #55

Open
dpelluzi opened this issue Sep 19, 2021 · 1 comment

Comments

@dpelluzi
Copy link

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?

@aminography
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants