material-calendarview icon indicating copy to clipboard operation
material-calendarview copied to clipboard

How to add more than one decorator to same date?

Open geidivan opened this issue 10 years ago • 2 comments

Hi,

I'm trying to add two spans using decorator, but just the last one shows up. How can I add span decorator without subscribe previous?

public class EventDecorator implements DayViewDecorator {

    private int color;
    private final HashSet<CalendarDay> dates;

    public EventDecorator(int color, Collection<CalendarDay> dates) {
        this.dates = new HashSet<>(dates);
        this.color = color;
    }

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

    @Override
    public void decorate(DayViewFacade view) {
        view.addSpan(new DotSpan(5, color));
        view.addSpan(new DotSpan(5, Color.BLUE)); // Just this appears.
    }
}

geidivan avatar Jan 26 '16 18:01 geidivan

I imagine the problem, is having two spans, rather than more than one decorator.

It should be possible, by mixing the two colours together and setting that as the colour on a single span.

http://stackoverflow.com/questions/6070163/color-mixing-in-android

lordcodes avatar Feb 10 '16 09:02 lordcodes

You are trying to add more than one span not decorator. I'll reopen if you are still having trouble.

Jogan avatar Apr 12 '16 03:04 Jogan