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

Disabled days #21

Closed
samiro opened this issue Mar 13, 2015 · 8 comments
Closed

Disabled days #21

samiro opened this issue Mar 13, 2015 · 8 comments
Milestone

Comments

@samiro
Copy link

samiro commented Mar 13, 2015

How disable any day?

@dandc87
Copy link
Contributor

dandc87 commented Mar 13, 2015

Hey @samiro, right now there isn't a way to disable individual days, only minimum and maximum dates can be set. I don't see this feature being a priority right now, unless it becomes popular.

As always, pull requests are welcome, but I would advise waiting for events (see #3) to be implemented so we can have a similar APIs.

@samiro
Copy link
Author

samiro commented Mar 13, 2015

Ok. Thank you very much.

@johnkil
Copy link

johnkil commented Apr 18, 2015

+1

@NicolaVerbeeck
Copy link

+1

@jsa-nic
Copy link

jsa-nic commented May 30, 2015

I just wanted to point out to anyone that's interested in this feature, that I managed to implement this functionality buy implementing onDateChanged, keeping track of the currently selected date and re-setting the currently selected date if the newly selected date should be disabled. The other thing that I had to do was implement a DayViewDecorator which set the disabled day's background to the same color as the calendar background.

@dandc87
Copy link
Contributor

dandc87 commented Jun 1, 2015

Thanks for the suggestion @jsa-nic!

@dandc87 dandc87 mentioned this issue Jun 22, 2015
@dandc87 dandc87 added this to the 1.0.0 milestone Jun 23, 2015
@dandc87
Copy link
Contributor

dandc87 commented Jun 24, 2015

Released in 0.6.0. Disabling days was added to the decorator system.

@dandc87 dandc87 closed this as completed Jun 24, 2015
@roeiros
Copy link

roeiros commented Aug 16, 2017

@dandc87 Can you provide an example for disabling certain dates?

I was trying to do as proposed here

ArrayList<CalendarDay> enabledDates = new ArrayList<>();


            enabledDates.add(new CalendarDay(new Date(2017, 8, 25)));
            enabledDates.add(new CalendarDay(new Date(2017, 8, 26)));
            enabledDates.add(new CalendarDay(new Date(2017, 8, 27)));
            enabledDates.add(new CalendarDay(new Date(2017, 8, 28)));
            enabledDates.add(new CalendarDay(new Date(2017, 8, 29)));
            enabledDates.add(new CalendarDay(new Date(2017, 8, 30)));
            enabledDates.add(new CalendarDay(new Date(2017, 9, 1)));
            enabledDates.add(new CalendarDay(new Date(2017, 9, 10)));
            enabledDates.add(new CalendarDay(new Date(2017, 9, 11)));
            enabledDates.add(new CalendarDay(new Date(2017, 9, 13)));
            enabledDates.add(new CalendarDay(new Date(2017, 9, 16)));
            enabledDates.add(new CalendarDay(new Date(2017, 9, 19)));


            mcv.addDecorator(new DayEnableDecorator(enabledDates));
public class DayEnableDecorator implements DayViewDecorator {
        private HashSet<CalendarDay> dates;

        public DayEnableDecorator(Collection<CalendarDay> dates) {
            this.dates = new HashSet<>(dates);
        }

        @Override
        public boolean shouldDecorate(CalendarDay day) {
            return dates.contains(day);
        }

        @Override
        public void decorate(DayViewFacade view) {
            view.setDaysDisabled(false);
        }
    }

However, it doesn't work and it seems like CalendarDay() is deprecated.
Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants