public final void setDate(Date date) {
mCurrentDate = date;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
MonthDisplayHelper monthHelper = new MonthDisplayHelper(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH));
cal.set(Calendar.DAY_OF_MONTH, monthHelper.getDayAt(0, 0));
if (monthHelper.getDayAt(0, 0) > 1) {
cal.add(Calendar.MONTH, -1);
}
mDates = new CalendarHelper[6 * getAmountDaysInWeek()];
int j = 0;
for (int i = 0; i < 6; i++) {
int n[] = monthHelper.getDigitsForRow(i);
for (int d = 0; d < n.length; d++) {
CalendarHelper tmp = new CalendarHelper(cal.getTime(), monthHelper.isWithinCurrentMonth(i, d), i == 0 || i == 6);
if (mShowWeekends || (!mShowWeekends && (d > 0 && d < 6))) {
mDates[j] = tmp;
j++;
}
cal.add(Calendar.DATE, 1);
}
}
notifyDataSetChanged();
}
CalendarAdapter.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:CustomizableCalendarView
作者:
评论列表
文章目录