Closed nicholas-gs closed 5 years ago
goToDate() also affected by setEventHeight()
The function setEventHeight()
also affects goToDate()
the same way as setHeaderRowTextSize()
does as described above. Removing the function call or calling it after setHeaderRowTextSize()
removes the bug.
Hi @wRorsjakz! The calls to goToDate()
and setHeaderRowTextSize()
both result in invalidate()
being called (see here and here), which apparently causes this issue when called in rapid succession.
I haven’t yet found a good solution to address this. For now, my advice would be to either move setHeaderRowTextSize()
below goToDate()
(as you’ve already done) or to set the header row text size in XML.
Thank you for your reply.
I managed to address the problem by ordering the function calls like you said. It was just that I had to programmatically change the header row text size based on the number of visible days the user selected for the widget, else the headers would overlap. Just wanted to point out the bug.
I’ll keep this issue open and will let you know once I’ve come up with a fix. If you want to contribute yourself, feel free to do so.
I was wrong: The issue was not related to the invalidation, but to the fact that WeekView
hadn't been laid out yet when you called goToDate()
. I fixed this issue in 43a3a6eb767eed8f4469f2d3af7faf20f9b1a1c2 and will release it with version 4.0.0 around mid-August.
I will close this issue now. Let me know if there’s anything else that’s not working as expected.
Describe the bug The widget was not scrolling to the date I passed it. While debugging, I removed all other functions/functionality and found that goToDate() behavior is affected by setHeaderRowTextSize().
To Reproduce Steps to reproduce the behavior:
With the above code, the widget does not scroll to 5 Nov!
However, if I removed the line
mWeekView.setHeaderRowTextSize(getResources().getInteger(R.integer.HEADER_14_SP));
, the widget scrolls correctly to 5 Nov.Interestingly, if I were to move that line below
mWeekView.goToDate(calendar);
like below, the widget scrolls correctly as well!Additional context