savvisingh / DateRangePicker

Date Range Picker is a Calendar Picker View to show a Customized Date Range Picker with improved UI and functionality to add subtitles to the dates
Apache License 2.0
784 stars 160 forks source link

Highlated cell click not working #66

Open vishalhalani opened 5 years ago

vishalhalani commented 5 years ago

Hello,

I have to show some highlated date cell . its highlated fine but even i want that cell click listener which i was not getting.

Any solution to handle highlated cell click.

aserheniuk commented 5 years ago

Hi, I had the same problem. I needed to highlight current day. Just use decorator without setCellClickInterceptor method. My code : calendarView.decorators = arrayListOf() calendarView.decorators.add(CalendarCellDecorator { cellView, date -> with(cellView) { if (DateUtils.isToday(date.time)) { if (viewModel.isSelectedDayIsNotHighlighted(date)) { isHighlighted = true dayOfMonthTextView.setTextColor(ContextCompat.getColor(context!!, R.color.black)) } else { isHighlighted = false dayOfMonthTextView.setTextColor(ContextCompat.getColor(context!!, R.color.white)) } } } })

if I clicked on highlighted changed on selectable background else on highlighted

vishalhalani commented 5 years ago

so now what solution for this anyone have an idea

aserheniuk commented 5 years ago

Hey. don't use .withHighlightedDate() method. Just write own decorator and check if date need to highlight set cellview.isHighlighted = true and click will be working. see my comment above