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

Final - Select range #315

Merged
merged 9 commits into from
May 23, 2016
Merged

Final - Select range #315

merged 9 commits into from
May 23, 2016

Conversation

quentin41500
Copy link
Member

As from @papageorgiouk PR, here is a final version of the select range feature.

  • Select range using SELECTION_MODE_RANGE
  • Select items in between range dates, including first and last date
  • Added api endpoint for selecting range (Select range possible even in SELECTION_MODE_NONE)
  • Added mode in sample app
  • Documented methods

@papageorgiouk feel free to review my final version. Credit as well to @damian-aragunde-udc for helping with this.

@ekchang @chahinem @Jogan

Fix #245

This adds select range functionality. When two dates are selected, the callback returns a sorted (ascending) list of dates in that range.

After that, if another date is selected, it clears the previous selection on the widget and waits for a second one for a new range select.

I tried to keep the documentation style as close to the original as possible. Please forgive any mistakes.

Usage

Set the new selection mode:
mcv.setSelectionMode(MaterialCalendarView.SELECTION_MODE_RANGE);

And the listener:
mcv.setOnRangeSelectedListener(new OnRangeSelectedListener() { @Override public void onRangeSelected(@NonNull MaterialCalendarView widget, @NonNull List<CalendarDay> dates) { // do stuff } });

The List<CalendarDay> dates is the desired range. It also works with a backwards selection, but the list will always be returned sorted in ascending order.

@papageorgiouk
Copy link
Contributor

Awesome! Happy to have contributed to such a useful project.

Cheers and keep up the good work. If there's anything else I can do, I'd be more than happy to oblige.

switch (mode) {
case SELECTION_MODE_MULTIPLE: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SELECTION_MODE_MULTIPLE shouldn't be removed, this is breaking selection mode multiple

@quentin41500
Copy link
Member Author

@ekchang All good now

@ekchang
Copy link
Contributor

ekchang commented May 23, 2016

LGTM 👍

@ekchang ekchang merged commit b0cb278 into future-1.x May 23, 2016
@quentin41500 quentin41500 deleted the select_range branch October 6, 2016 22:06
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

Successfully merging this pull request may close these issues.

3 participants