-
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
Adding views in decorators #373
Comments
During breakpoint debugging and stepping through, I found that the issue wasn't always present. That may indicate a race condition, which would be extremely problematic. |
@magneticflux- hard to say without more info. can you try checking out the repo and see if you can repro the issue in the sample app? if so, push your fork and ping me here and i'll take a look. |
One thing that might be the issue: you're adding the view if |
@edenman I looked around in the library's source for where rows were being recycled, but I couldn't find it. Could you explain where I should remove it? |
@magneticflux-
|
@edenman Removing the custom view in the |
@magneticflux- not sure. try adding some logging to see what's happening? |
@edenman I'm going to try to isolate it down to the simplest setup that reproduces it in the sample app. |
@edenman Here it is: https://github.com/magneticflux-/android-times-square/tree/decorator-view-add-bug |
Not sure why, but I had to manually measure+layout the view to get this working. Maybe because you're manually constructing the view instead of inflating it with the parent set? |
Anyway, you should be good to go |
(i pushed the fix to your branch) |
@edenman The measure+layout solution worked for me, but it's extremely unwieldy when I'm trying to add several views inside of a LinearLayout. I tried using a LayoutInflater to attach a layout to the root (the |
no idea. let me know if you figure it out! |
Upon inspecting the layout, the buttons are part of the view hierarchy but they have their width/height/measuredWidth/measuredHeight set to 0. I'm going to look through the measurement process of the custom views because I think that something might be missing there. |
@edenman I have come to the conclusion that the views are not being shown because the decorator is run during the |
@magneticflux- you might just want to use |
(or just manually measure/layout, hacky though it may be) |
@edenman FYI, I tested measure+layout with a Unfortunately, I was planning to add a dynamic number of views to each date so I could achieve a Google Calendar-like functionality. I'm going to try adding a ListView/RecyclerView to each cell and populate them with the decorator, but I'm worried that won't work either. |
Adding items in a |
In addition, the fact that decorators operate inside of a layout pass means that merely setting the background drawable of a cell results in dozens of warnings like the following:
I think a fix for this and several other issues would be to move all of the decoration loop out of the layout stage and later in the setup of the views, but I don't know how that could be accomplished. |
Adding new views in decorators that depend on the date seems extremely buggy.
Steps to reproduce:
Create a
CalendarCellDecorator
that adds a TextView to theCellView
containing the provided date only if the day of the month is30
.Expected behavior:
The date is the same as the date shown on the original TextView and the new view only appears the 30th of the month.
Actual behavior:
The date always says
30
, but the view appears on dates that are not the 30th of the month.The text was updated successfully, but these errors were encountered: