Horizontal-Calendar
Horizontal-Calendar copied to clipboard
CalendarEventsPredicate ignores List<> colors
Expected Behavior / Goals
Using the events()
callback in addEvents(new CalendarEventsPredicate())
should allow adding different colored dots to a calendar day.
Actual Behavior
addEvents()
sets all of the events for that day to the same color -- the last color in the array is the only one used. All of the event colors are the same as the last element of the array
Steps to Reproduce the Problem (sample code if possible)
This results on 2 green events on all days, even though a RED one is configured.
mCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
.range(startDate, endDate)
.datesNumberOnScreen(5)
.addEvents(new CalendarEventsPredicate() {
int RED = getResources().getColor(R.color.md_red_700);
int GREEN = getResources().getColor(R.color.md_green_600);
@Override
public List<CalendarEvent> events(Calendar date) {
events.clear();
events.add(new CalendarEvent(RED, "red")); // <-- ignored
events.add(new CalendarEvent(GREEN, "green"));
return events;
}
})
.build();
Specifications
- Android Version: API 27
- Horizontal-Calendar Version: 1.3.4