When I try to modify the style of some day cell through CalendarViewCell, the style is also added to the previous or next month if there is space enough. So sometimes appears wrong days inside a month.
I attach a screenshot to improve my poor explanations.
This is my code:
CalendarCellDecorator calendarCellDecorator = new CalendarCellDecorator() {
@Override
public void decorate(CalendarCellView cellView, Date date) {
for(Evento evento: eventos){
if(evento.getDate().getTime()==date.getTime()){
int color = getResources().getColor(R.color.white);
Drawable bg = getResources().getDrawable(R.drawable.bg_festivo);
switch (evento.getTipo()){
case Evento.TIPO_NO_LABORAL: color = getResources().getColor(R.color.calendar_bg_no_laboral); break;
case Evento.TIPO_BLOQUEADO: color = getResources().getColor(R.color.calendar_bg_bloqueado); break;
case Evento.TIPO_VACACION: color = getResources().getColor(R.color.calendar_bg_vacacion); break;
}
bg.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
cellView.getDayOfMonthTextView().setBackground(bg);
TextView tv = cellView.getSubTitleTextView();
tv.setText(evento.getDetalle());
tv.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_END);
tv.setTextSize(11); // Aumentamos el tamaño
}
}
}
};
When I try to modify the style of some day cell through CalendarViewCell, the style is also added to the previous or next month if there is space enough. So sometimes appears wrong days inside a month. I attach a screenshot to improve my poor explanations.
This is my code: