SimonVT/android-calendarview — pull request #7 by bkromhout (2013-06-19 23:35:56+00:00)
Title: CalendarView.java was updated to fix various drawing bugs

I've added comments to all of the changed areas to explain why I made the changes and what bugs the changes fix. I've tested the changes extensively.

Here's the edge case example I mentioned in my comments:
Obviously, the loop in WeekView.init() used to populate the mDayNumbers[] array increments mTempDate by EXACTLY one day each time it executes. This can cause a bug when mTempDate finally increments to be the same day as mMaxDate.

To better explain the bug, here's an example. Say the time of day of mMinDate is 5:00pm, and the time of day of mMaxDate is 3:00pm. When mTempDate is finally incremented enough that it is the same DAY as mMaxdate, its time of day is still 2 hours past the time of day of mMaxDate.

Due to this, even though the day number of mTempDate SHOULD be drawn, the original code won't draw it, because the boolean expression used in the aforementioned loop only tests to see if mTempDate is after mMaxDate.

To fix this, the loop now also tests to see if mTempDate is the same day as mMaxDate (Using the already existing isSameDate() method).
This ensures that the day number for mMaxDate is drawn even if the time of day of mTempDate puts mTempDate after mMaxDate, so long as mTempDate and mMaxDate have the same DAY_OF_YEAR and YEAR values.

The reason WeeksAdapter.onTouch() was modified was because otherwise even though the number is drawn, we still wouldn't be able to select it for the same reasons given above.

Apologies for this explanation being so lengthy.