public void setMonthParams ( int selectedDay , int year , int month , int weekStart ) { if ( month == - 1 && year == - 1 ) { throw new InvalidParameterException ( "You must specify month and year for this view" ) ; } mSelectedDay = selectedDay ; // Allocate space for caching the day numbers and focus values mMonth = month ; mYear = year ; // Figure out what day today is //final Time today = new Time(Time.getCurrentTimezone()); //today.setToNow(); final Calendar today = Calendar . getInstance ( mController . getTimeZone ( ) , mController . getLocale ( ) ) ; mHasToday = false ; mToday = - 1 ; mCalendar . set ( Calendar . MONTH , mMonth ) ; mCalendar . set ( Calendar . YEAR , mYear ) ; mCalendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; mDayOfWeekStart = mCalendar . get ( Calendar . DAY_OF_WEEK ) ; if ( weekStart != - 1 ) { mWeekStart = weekStart ; } else { mWeekStart = mCalendar . getFirstDayOfWeek ( ) ; } mNumCells = mCalendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ; for ( int i = 0 ; i < mNumCells ; i ++ ) { final int day = i + 1 ; if ( sameDay ( day , today ) ) { mHasToday = true ; mToday = day ; } } mNumRows = calculateNumRows ( ) ; // Invalidate cached accessibility information. mTouchHelper . invalidateRoot ( ) ; }
Sets all the parameters for displaying this week . The only required parameter is the week number . Other parameters have a default value and will only update if a new value is included except for focus month which will always default to no focus month if no value is passed in .