question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to DisableDecorator to one days of week?

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
quentin41500commented, May 18, 2016

@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);
        }
    }
1reaction
emitchelcommented, Apr 28, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

toggling decorators - python - Stack Overflow
When I have to enable or disable decorators by module, I just have a function that makes a new SwitchedDecorator whenever I need...
Read more >
Leveraging the power of decorators in Python's unit-test ...
We created a decorator that can, with a single line addition, can make a test run with the control-flag disabled. The status of...
Read more >
Examples — schedule 1.1.0 documentation - Read the Docs
Run job every 3 second/minute/hour/day/week, ... To remove a job from the scheduler, use the schedule.cancel_job(job) method.
Read more >
Cancelling building or decorating work - Citizens Advice
When you can cancel building or decorating work, how to cancel, when you're entitled to your money back, how to negotiate with the...
Read more >
What are decorators and how are they used in JavaScript
Example 1: In this example, we are passing two arguments and here the decorator function checks if the descriptor is function or not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found