/** 下一月日历 */ public synchronized void nextMonth() { selectCol = -1; selectRow = -1; // 改变日历上下顺序 if (currentCalendar == firstCalendar) { currentCalendar = secondCalendar; } else { currentCalendar = firstCalendar; } // 设置动画 setInAnimation(push_left_in); setOutAnimation(push_left_out); // 改变日历日期 if (calendarMonth == Calendar.DECEMBER) { calendarYear++; calendarMonth = Calendar.JANUARY; } else { calendarMonth++; } calendarday = new Date(calendarYear - 1900, calendarMonth, 1); // 填充日历 setCalendarDate(); // 下翻到下一月 showNext(); // 回调 if (onCalendarDateChangedListener != null) { onCalendarDateChangedListener.onCalendarDateChanged(calendarYear, calendarMonth + 1); } }
/** 上一月日历 */ public synchronized void lastMonth() { selectCol = -1; selectRow = -1; if (currentCalendar == firstCalendar) { currentCalendar = secondCalendar; } else { currentCalendar = firstCalendar; } setInAnimation(push_right_in); setOutAnimation(push_right_out); if (calendarMonth == Calendar.JANUARY) { calendarYear--; calendarMonth = Calendar.DECEMBER; } else { calendarMonth--; } calendarday = new Date(calendarYear - 1900, calendarMonth, 1); setCalendarDate(); showPrevious(); if (onCalendarDateChangedListener != null) { onCalendarDateChangedListener.onCalendarDateChanged(calendarYear, calendarMonth + 1); } }