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

Added an alternate range selection mode #91

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adriancoman
Copy link

Added a new way to select date ranges, similar to the one Airbnb uses.

After the user selects the first date and chooses a second date, it will automatically create a range between those two dates.
Ex: I first select 2nd of March and then select 10th of March it will select this date range without the need to long press and drag.

If you want to select another date, just chose a date and you can go through the process of range selection again.

@matthewkrueger
Copy link

This is exactly what I'm looking for - tap once to pick the start date, tap again to pick the end date. Any way you can merge this pull request in to the project would be appreciated!

@jimmyleonardo
Copy link

@vikramkakkar Hi Man, We need this feature, can you merge this PR? Thank you.
CC: @hengkiardo

@enmanuelmartinez
Copy link

enmanuelmartinez commented May 15, 2019

@vikramkakkar this feature that is missing, I have been searching on Internet several days and this is the Best but only missing that feature because is more naturally for the user select de date ranges by single tounch with the finger and not keeping press. I have implemented in an app and I was to force back, because users feel losing when they need to select a range of days and they dont know what is supose to do.

@achatina
Copy link

You have 2 bugs.
Reset button not working
If you select dates in different months, scroll start working badly. (e.g. you pick 1 of September -> wipe to November -> select 1st of November -> make swipe back. It will returns you to august, not October)

@adriancoman
Copy link
Author

adriancoman commented Oct 25, 2019

Hey @achatina, are the bugs that you mentioned present only in this pull request or is it in master as well? Will try and fix them next week, thx.

@achatina
Copy link

@adriancoman
Yes, only in your PR.
I was a little bit inattentive. The second bug a little bit different.}
you pick 1 of September -> wipe to November -> select 1st of November -> you will be scrolled to September. So the previous is August. I have fixed it (import your fork).

First bug fixing by:
ivHeaderDateReset in SublimeDatePicker edit switchToDateRangeView

if (isAlternateDatePicker) {
            tvHeaderDateStart.setActivated(true);
            tvHeaderDateEnd.setActivated(true);
            ivHeaderDateReset.setVisibility(View.GONE);
        } else {
            ivHeaderDateReset.setVisibility(View.VISIBLE);
            tvHeaderDateStart.setActivated(mCurrentlyActivatedRangeItem == RANGE_ACTIVATED_START);
            tvHeaderDateEnd.setActivated(mCurrentlyActivatedRangeItem == RANGE_ACTIVATED_END);
        }

For the second one modify onDaySelected in DayPickerView.ProxyDaySelectionEventListener mProxyDaySelectionEventListener:
remove goToPosition field and at the end do:
onDateChanged(true, false, !isAlternateDatePicker);

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.

5 participants