I need DisableDecorator to one days of week. for example disale Decorator for all Monday days.
How to do it using method
private class PrimeDayDisableDecorator implements DayViewDecorator {
}
thanks
I also need the function.Have you made it????
+1
+1
I am very urgent.I am very eager to know....
Seeking master......
Reading the decorators doc will help https://github.com/prolificinteractive/material-calendarview/blob/master/docs/DECORATORS.md.
You would just pass in a collection of all mondays and then you can decorate just the mondays.
@emitchel Thank you very much
@emitchel but I want to disable one day of week not several days. The function can be achieved?
@Brucezh Just pass in one day into the constructor, i.e. One Decorator class for the day - not efficient but it works.
@erioana If you wanna disable Mondays:
private static class PrimeDayDisableDecorator implements DayViewDecorator {
@Override
public boolean shouldDecorate(CalendarDay day) {
day.copyTo(calendar);
int weekDay = calendar.get(Calendar.DAY_OF_WEEK);
return weekDay == Calendar.MONDAY;
}
@Override
public void decorate(DayViewFacade view) {
view.setDaysDisabled(true);
}
}
@Brucezh If you want to disable specific days or just one day. You can pass just one day or a collection:
private static class PrimeDayDisableDecorator implements DayViewDecorator {
private HashSet<CalendarDay> dates;
public PrimeDayDisableDecorator(Collection<CalendarDay> dates) {
this.dates = new HashSet<>(dates);
}
@Override
public boolean shouldDecorate(CalendarDay day) {
dates.contains(day);
}
@Override
public void decorate(DayViewFacade view) {
view.setDaysDisabled(true);
}
}
Thanks @quentin41500
Most helpful comment
@erioana If you wanna disable Mondays:
@Brucezh If you want to disable specific days or just one day. You can pass just one day or a collection: