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

Feature/date range without long press #73

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

Conversation

kiewietn
Copy link

This resolves issue #53 .
SublimeOptions have been modified to change behaviour between existing long press for date range selection and 2 taps for range selection.

Use the option SublimeOptions.setToggleRangeWithoutLongPress(true) when initializing SublimePicker.

- When this option is enabled the date-range option is also enabled. This allows the user to tap on two dates to select the interval of dates inclusive.
- The option is applies using SublimeOptions.setToggleRangeWithoutLongPress(...)
- The behaviour of long select of date range remains unaffected when setToggleRangeWithoutLongPress is disabled.
- Update sample app with range select without long press option.
… fills in the range between first tap and current tap.
@kevinliu23
Copy link

kevinliu23 commented Jun 14, 2018

@vikramkakkar Hi Vikram, can I get some help on an issue. I'm trying to implement the following behavior but having trouble.

Click on a day to select it, long click on the second date to select the range between the two dates.

Can you do it or show me show me in the right direction. Here is what I've tried:

I see that on DayPickerViewPager.java class, the place where you set mIsLongPressed = true is where you determine if it's been long pressed, I was able to keep track of the last start date and modify the mTempSelectedDate's start or end date (depending on which date is before or after the other). But there are small bugs here and there, mainly to do with

tvHeaderDateStart.setActivated(mCurrentlyActivatedRangeItem == RANGE_ACTIVATED_START);
tvHeaderDateEnd.setActivated(mCurrentlyActivatedRangeItem == RANGE_ACTIVATED_END);

In SublimeDatePicker.java and some other issues.

Would you happen to know an easy to way to simply do this:

  1. Given the user has 1 day selected (not a date range), if user long clicks on a different date, select the date range.
  2. If user repeats the long click action while a date range is selected, it would just extend/modify the current date range to include that date.

@SebRut
Copy link

SebRut commented Feb 25, 2019

@vikramkakkar @vikram-kakkar Could you check this PR?

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