/** * Draws the week and month day numbers for this week. Override this method * if you need different placement. * * @param canvas The canvas to draw on */ protected void drawMonthNums(Canvas canvas) { int y = (((mRowHeight + MINI_DAY_NUMBER_TEXT_SIZE) / 2) - DAY_SEPARATOR_WIDTH) + MONTH_HEADER_SIZE; int dayWidthHalf = (mWidth - mPadding * 2) / (mNumDays * 2); int j = findDayOffset(); for (int dayNumber = 1; dayNumber <= mNumCells; dayNumber++) { int x = (2 * j + 1) * dayWidthHalf + mPadding; int yRelativeToDay = (mRowHeight + MINI_DAY_NUMBER_TEXT_SIZE) / 2 - DAY_SEPARATOR_WIDTH; int startX = x - dayWidthHalf; int stopX = x + dayWidthHalf; int startY = y - yRelativeToDay; int stopY = startY + mRowHeight; drawMonthDay(canvas, mYear, mMonth, dayNumber, x, y, startX, stopX, startY, stopY); j++; if (j == mNumDays) { j = 0; y += mRowHeight; } } }
/** * Draws the week and month day numbers for this week. Override this method * if you need different placement. * * @param canvas The canvas to draw on */ protected void drawMonthNums(Canvas canvas) { int y = (((mRowHeight + MINI_DAY_NUMBER_TEXT_SIZE) / 2) - DAY_SEPARATOR_WIDTH) + getMonthHeaderSize(); final float dayWidthHalf = (mWidth - mEdgePadding * 2) / (mNumDays * 2.0f); int j = findDayOffset(); for (int dayNumber = 1; dayNumber <= mNumCells; dayNumber++) { final int x = (int)((2 * j + 1) * dayWidthHalf + mEdgePadding); int yRelativeToDay = (mRowHeight + MINI_DAY_NUMBER_TEXT_SIZE) / 2 - DAY_SEPARATOR_WIDTH; final int startX = (int)(x - dayWidthHalf); final int stopX = (int)(x + dayWidthHalf); final int startY = (int)(y - yRelativeToDay); final int stopY = (int)(startY + mRowHeight); drawMonthDay(canvas, mYear, mMonth, dayNumber, x, y, startX, stopX, startY, stopY); j++; if (j == mNumDays) { j = 0; y += mRowHeight; } } }