Closed dzafiri closed 5 years ago
Use a decorator
You need to create a DayViewDecorator like the code below(replace the R.color.grey with a color you want):
`class PastDaysDecorator(private val context: Context) : DayViewDecorator {
override fun shouldDecorate(day: CalendarDay): Boolean {
return day.isBefore(CalendarDay.today())
}
override fun decorate(view: DayViewFacade) {
view.addSpan(ForegroundColorSpan(ContextCompat.getColor(context, R.color.grey)))
}
}`
You need to create a DayViewDecorator like the code below(replace the R.color.grey with a color you want):
`class PastDaysDecorator(private val context: Context) : DayViewDecorator {
override fun shouldDecorate(day: CalendarDay): Boolean { return day.isBefore(CalendarDay.today()) } override fun decorate(view: DayViewFacade) { view.addSpan(ForegroundColorSpan(ContextCompat.getColor(context, R.color.grey))) }
}`
Thanks!!! you rock
Is there a way to set different color to past dates ?