android.util.MonthDisplayHelper Java Examples

The following examples show how to use android.util.MonthDisplayHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: BigApp_Discuz_Android   Author: BigAppOS   File: CalendarView.java    License: Apache License 2.0 6 votes vote down vote up
private void initCalendarView() {
	mRightNow = Calendar.getInstance();
	mHelper = new MonthDisplayHelper(mRightNow.get(Calendar.YEAR),
			mRightNow.get(Calendar.MONTH), mRightNow.getFirstDayOfWeek());

	mBackgroundColor = new Paint();
	mBackgroundColorToday = new Paint();
	mBackgroundColorTouched = new Paint();
	mWeekTitle = new Paint(Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
	mLinePaint = new Paint();
	mLinePaint2 = new Paint();

	mBackgroundColor.setColor(Color.WHITE);
	mBackgroundColorToday.setColor(Color.RED);
	mBackgroundColorToday.setAlpha(100);
	mBackgroundColorTouched.setColor(Color.BLUE);
	mBackgroundColorTouched.setAlpha(100);
	mWeekTitle.setColor(Color.rgb(135, 135, 135));
	mLinePaint.setColor(Color.BLACK);
	mLinePaint2.setColor(Color.rgb(90, 90, 90));
}
 
Example #2
Source Project: BonetCalendarView   Author: ebonet   File: DayGridAdapter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Changes the content data to display the given month
 * @param month
 */
public void setMonth(BtMonth month) {
	
	Log.d("",month+"");
	mMonth = month;
	
	// Starts at Sunday
	mMonthDisplay = new MonthDisplayHelper(mMonth.getYear(), mMonth.getMonth());
	
	// number of cells is 7 times the row of the last day plus 1.
	mNumCells = (mMonthDisplay.getRowOf(mMonthDisplay.getNumberOfDaysInMonth())+1) * 7;
}
 
Example #3
Source Project: BonetCalendarView   Author: ebonet   File: GridBtMonthViewProvider.java    License: Apache License 2.0 5 votes vote down vote up
public GridBtMonthViewProvider(Context context, BtMonth month) {
	super(month);
	
	mContext = context;
	
	Log.d("", "Criando DayGridAdapter");
	mAdapter = new DayGridAdapter(context,month,getMinDate(),getMaxDate());

	mMonthDisplay = new MonthDisplayHelper(month.getYear(), month.getMonth());

	mGridItemClickedListener = new OnItemClickListener() {
		
		@Override
		public void onItemClick(AdapterView<?> adapter, View arg1, int position,
				long arg3) {
			
			int fp = mMonthDisplay.getRowOf(1)*7+mMonthDisplay.getColumnOf(1);
			int lp = fp+ mMonthDisplay.getNumberOfDaysInMonth();
			
			// Checks to see if the position selected represents a date within the month
			if(position >= fp && position <lp) {
			
				BtDate day;
				// Checks to see if the selected date is within the defined bounds
				if( (day = getMonth().getDate(position+1-fp)).isWithinBounds(getMinDate(),getMaxDate()))
					selectDay(day);
				
			}
		}
	};
	
}
 
Example #4
Source Project: BonetCalendarView   Author: ebonet   File: GridBtMonthViewProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setMonth(BtMonth month) {
	mMonthDisplay = new MonthDisplayHelper(month.getYear(), month.getMonth());
	
	mAdapter.setMonth(month);
	
	super.setMonth(month);
}
 
Example #5
Source Project: FlexibleCalendar   Author: p-v   File: FlexibleCalendarGridAdapter.java    License: MIT License 4 votes vote down vote up
public void initialize(int year, int month, int startDayOfTheWeek) {
    this.year = year;
    this.month = month;
    this.monthDisplayHelper = new MonthDisplayHelper(year, month, startDayOfTheWeek);
    this.calendar = FlexibleCalendarHelper.getLocalizedCalendar(context);
}
 
Example #6
Source Project: FlexibleCalendar   Author: p-v   File: FlexibleCalendarGridAdapter.java    License: MIT License 4 votes vote down vote up
public void setFirstDayOfTheWeek(int firstDayOfTheWeek) {
    monthDisplayHelper = new MonthDisplayHelper(year, month, firstDayOfTheWeek);
    this.notifyDataSetChanged();
}
 
Example #7
Source Project: BonetCalendarView   Author: ebonet   File: DayGridAdapter.java    License: Apache License 2.0 4 votes vote down vote up
public MonthDisplayHelper getDisplayHelper(){
	return mMonthDisplay;
}
 
Example #8
Source Project: FlexibleCalendar   Author: p-v   File: FlexibleCalendarHelper.java    License: MIT License 3 votes vote down vote up
/**
 * Get the number of rows for the provided month
 *
 * @param year  year
 * @param month month
 * @return number of rows
 */
public static int getNumOfRowsForTheMonth(int year, int month, int startDayOfTheWeek) {
    Calendar cal = Calendar.getInstance();
    cal.set(year, month, 1);
    MonthDisplayHelper displayHelper = new MonthDisplayHelper(year, month, startDayOfTheWeek);
    return displayHelper.getRowOf(cal.getActualMaximum(Calendar.DAY_OF_MONTH)) + 1;
}