/** * Gets the first day of the first week in the currently specified month. * * @return the first day */ public Date getCurrentFirstDayOfFirstWeek() { int wkDayOfMonth1st = currentMonth.getDay(); int start = CalendarUtil.getStartingDayOfWeek(); if (wkDayOfMonth1st == start) { // always return a copy to allow SimpleCalendarView to adjust first // display date return new Date(currentMonth.getTime()); } else { Date d = new Date(currentMonth.getTime()); int offset = wkDayOfMonth1st - start > 0 ? wkDayOfMonth1st - start : DAYS_IN_WEEK - (start - wkDayOfMonth1st); CalendarUtil.addDaysToDate(d, -offset); return d; } }
int shift = CalendarUtil.getStartingDayOfWeek(); int dayIdx = i + shift < CalendarModel.DAYS_IN_WEEK ? i + shift : i + shift - CalendarModel.DAYS_IN_WEEK;
/** * Gets the first day of the first week in the currently specified month. * * @return the first day */ public Date getCurrentFirstDayOfFirstWeek() { int wkDayOfMonth1st = currentMonth.getDay(); int start = CalendarUtil.getStartingDayOfWeek(); if (wkDayOfMonth1st == start) { // always return a copy to allow SimpleCalendarView to adjust first // display date return new Date(currentMonth.getTime()); } else { Date d = new Date(currentMonth.getTime()); int offset = wkDayOfMonth1st - start > 0 ? wkDayOfMonth1st - start : DAYS_IN_WEEK - (start - wkDayOfMonth1st); CalendarUtil.addDaysToDate(d, -offset); return d; } }
/** * Gets the first day of the first week in the currently specified month. * * @return the first day */ public Date getCurrentFirstDayOfFirstWeek() { int wkDayOfMonth1st = currentMonth.getDay(); int start = CalendarUtil.getStartingDayOfWeek(); if (wkDayOfMonth1st == start) { // always return a copy to allow SimpleCalendarView to adjust first // display date return new Date(currentMonth.getTime()); } else { Date d = new Date(currentMonth.getTime()); int offset = wkDayOfMonth1st - start > 0 ? wkDayOfMonth1st - start : DAYS_IN_WEEK - (start - wkDayOfMonth1st); CalendarUtil.addDaysToDate(d, -offset); return d; } }
int shift = CalendarUtil.getStartingDayOfWeek(); int dayIdx = i + shift < CalendarModel.DAYS_IN_WEEK ? i + shift : i + shift - CalendarModel.DAYS_IN_WEEK;
int shift = CalendarUtil.getStartingDayOfWeek(); int dayIdx = i + shift < CalendarModel.DAYS_IN_WEEK ? i + shift : i + shift - CalendarModel.DAYS_IN_WEEK;