Open nbeuret opened 7 years ago
@nbeuret I'm sorry for the late reply, seems I forgot to. Can you add an event to the example class from 17 tot 00 ? And check if that event is shown ? If you push it to a fork, I can also test it and debug.
Can confirm this bug. Any event that ends at 00:00 is not shown.
EDIT: I've figured out what's causing this issue:
Inside the expandEventsToMaxWidth(List<EventRect> collisionGroup)
method in the WeekView class, at line 1414 this statement is the root cause:
eventRect.bottom = getPassedMinutesInDay(eventRect.event.getEndTime());
For events where the endTime is midnight of the next day, the getPassedMinutesInDay()
method will return 0.
Later on, when the library tries to render the rectangle for the event in the drawEvents(Calendar date, float startFromPixel, Canvas canvas)
method, the following statement, bottom = mHourHeight * bottom / 60 + mCurrentOrigin.y + mHeaderHeight + mHeaderRowPadding * 2 + mHeaderMarginBottom + mTimeTextHeight/2 - mEventMarginVertical - marginTop;
at line 1039 will produce a negative float because bottom is 0.
Finally, the If statement at line 1050 if (left < right && left < getWidth() && top < getHeight() && right > mHeaderColumnWidth && bottom > mHeaderHeight + mHeaderRowPadding * 2 + mTimeTextHeight / 2 + mHeaderMarginBottom)
that determines whether or not the EventRect has valid coordinates will fail and result in the event's rectangle getting set to null
.
@jhoobergs Any chance you could take a look at my pull-request that fixes this issue any time soon?
Hi,
I cannot figure out how to display events ending at exactly midnight.
For example, an event starting at 5PM (eg. Sep 21, 2017 17:00:00) and ending the day after at midnight (eg. Sep 22, 2017 00:00:00) is not displayed in the week-view.
In this example, the event is correctly display if it ends on Sep 21, at 23:59 and also when it ends on Sep 22 at 00:01.
Note that if the event lasts more than 2 days (eg. starts on Sept 20), the event is correctly displayed.
I'm using the version 2.0.2 Am I missing something or is it an issue ? Thank you