-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Cannot reset decorators #220
Comments
Thanks for the report @basit-saeed. Will take a look soon. For now the workaround would just be re-initializing the calendar, but obviously that's unfortunate. |
Thank you for looking into it @edenman. Re-initializing the calendar view was the first option that came in my mind but due to project constraints, I couldn't do it. I came up with a different solution, though. I created a default decorator class for the calendar, picked up disabled/enabled background colors from the calendar image in readme file, and decorated them that way. Here's a sample code (and neccessary colors) if anyone wants to implement it. Be advised, it is a workaround and I just created it as a placeholder while an official solution is being developed (I hope :) ). Colors:
Decorator class:
I'm haven't yet given it a style of selected date, though. Will look into it once I have some time. |
The behavior I'm seeing isn't so much that you can't reset decorators. From my testing, you can override an existing decorator by applying a new decorator that applies to the same date(s). The issue I am seeing is that if a decorator changes the drawable state of a cell, and that decorator is removed, the drawing performed by the decorator remains on the cell. Another side effect I am seeing of this is that the drawing from the decorator is not removed from a recycled view. You can reproduce this using a bare calendar and the following decorator:
Every third month you should see a decorated cell. Listed workaround is good in the short term. |
Refactoring the decorator pattern to look something like this -- wokkaflokka@939ce95 -- worked for my use case. |
My code is at production level. @edenman @JakeWharton please help. |
I'm trying to reset decorators after certain action is performed in the app by calling
calendarView.setDecorators(Collections.emptyList()); but it won't work, the decorators stay as I set them using custom decorator class.
What's the solution to this? I don't want to re-initialize the entire calendar every time that action is performed.
The text was updated successfully, but these errors were encountered: