public CalendarDay getDayFromLocation ( float x , float y ) { int dayStart = mPadding ; if ( x < dayStart || x > mWidth - mPadding ) { return null ; } // Selection is (x - start) / (pixels/day) == (x -s) * day / pixels int row = ( int ) ( y - MONTH_HEADER_SIZE ) / mRowHeight ; int column = ( int ) ( ( x - dayStart ) * mNumDays / ( mWidth - dayStart - mPadding ) ) ; int day = column - findDayOffset ( ) + 1 ; day += row * mNumDays ; if ( day < 1 || day > mNumCells ) { return null ; } return new CalendarDay ( mYear , mMonth , day ) ; }
Calculates the day that the given x position is in accounting for week number . Returns a Time referencing that day or null if