Back to project page BonetCalendarView.
The source code is released under:
Apache License
If you think the Android project BonetCalendarView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.bonet.example.bonetcalendarviewactivity; //ww w .ja v a 2 s . c o m import android.content.Context; import android.util.AttributeSet; import com.bonet.views.BtCalendarView; import com.bonet.views.BtDate; import com.bonet.views.BtMonth; import com.bonet.views.GridBtMonthViewProvider; public class CustomGridCalendar extends BtCalendarView{ /* Let's highlight the current selected date */ private BtDate mSelectedDay; CustomDayGridAdapter mDayAdapter; public CustomGridCalendar(Context context) { this(context,null); } public CustomGridCalendar(Context context, AttributeSet attr){ super(context,attr); mSelectedDay = BtDate.today(); GridBtMonthViewProvider provider = new CustomMonthProvider(context, BtMonth.fromDay(mSelectedDay)); mDayAdapter = new CustomDayGridAdapter(context ,BtMonth.fromDay(mSelectedDay), getMinDate(), getMaxDate(), mSelectedDay); provider.setAdapter(mDayAdapter); initialize(provider, new CustomYearProvider(this, mSelectedDay.getYear())); } public void setSelectedDate(int year,int month,int day){ mSelectedDay = new BtDate(year, month, day); mDayAdapter.setSelectedDay(mSelectedDay); } @Override public void onDateSelected(int year, int month, int day) { setSelectedDate(year,month,day); super.onDateSelected(year, month, day); } }