Methods Summary |
---|
public int | getColumnOf(int day)
return (day + mOffset - 1) % 7;
|
public int | getDayAt(int row, int column)
if (row == 0 && column < mOffset) {
return mNumDaysInPrevMonth + column - mOffset + 1;
}
int day = 7 * row + column - mOffset + 1;
return (day > mNumDaysInMonth) ?
day - mNumDaysInMonth : day;
|
public int[] | getDigitsForRow(int row)
if (row < 0 || row > 5) {
throw new IllegalArgumentException("row " + row
+ " out of range (0-5)");
}
int [] result = new int[7];
for (int column = 0; column < 7; column++) {
result[column] = getDayAt(row, column);
}
return result;
|
public int | getFirstDayOfMonth()
return mCalendar.get(Calendar.DAY_OF_WEEK);
|
public int | getMonth()
return mCalendar.get(Calendar.MONTH);
|
public int | getNumberOfDaysInMonth()
return mNumDaysInMonth;
|
public int | getOffset()
return mOffset;
|
public int | getRowOf(int day)
return (day + mOffset - 1) / 7;
|
public int | getWeekStartDay()
return mWeekStartDay;
|
public int | getYear()
return mCalendar.get(Calendar.YEAR);
|
public boolean | isWithinCurrentMonth(int row, int column)
if (row < 0 || column < 0 || row > 5 || column > 6) {
return false;
}
if (row == 0 && column < mOffset) {
return false;
}
int day = 7 * row + column - mOffset + 1;
if (day > mNumDaysInMonth) {
return false;
}
return true;
|
public void | nextMonth()Increment the month.
mCalendar.add(Calendar.MONTH, 1);
recalculate();
|
public void | previousMonth()Decrement the month.
mCalendar.add(Calendar.MONTH, -1);
recalculate();
|
private void | recalculate()
mNumDaysInMonth = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
mCalendar.add(Calendar.MONTH, -1);
mNumDaysInPrevMonth = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
mCalendar.add(Calendar.MONTH, 1);
int firstDayOfMonth = getFirstDayOfMonth();
int offset = firstDayOfMonth - mWeekStartDay;
if (offset < 0) {
offset += 7;
}
mOffset = offset;
|