Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Days style appears on wrong month #71

Open
jkydevelopment opened this issue Aug 23, 2019 · 0 comments
Open

Days style appears on wrong month #71

jkydevelopment opened this issue Aug 23, 2019 · 0 comments

Comments

@jkydevelopment
Copy link

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.

git_issue

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
                            }
                        }
                    }
                };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant