From a9eb895df3cb0ebb2d57c9667300300026bda333 Mon Sep 17 00:00:00 2001 From: Ilia Kurtov Date: Mon, 7 Nov 2016 18:08:05 +0300 Subject: [PATCH 1/2] Anton Domnikov calendar fix --- .../ru/touchin/templates/calendar/CalendarUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java b/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java index 99678a6..c73ff19 100644 --- a/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java +++ b/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java @@ -59,7 +59,7 @@ public final class CalendarUtils { * @param calendarItems List of {@link CalendarItem} where need to find specific element; * @param position Position of adapter; * @return Position of Header that respond to requested position. - * Returns null if Header or related CalendarItem was not found for specified position. + * Returns null if Header or related CalendarItem was not found for specified position. */ @Nullable public static Integer findPositionOfSelectedMonth(@NonNull final List calendarItems, final long position) { @@ -76,7 +76,7 @@ public final class CalendarUtils { * @param calendarItems List of {@link CalendarItem} where need to find specific element; * @param date Requested date in milliseconds. * @return Position of Calendar cell that that has specific date. - * Returns null if CalendarItem was not found for specified position. + * Returns null if CalendarItem was not found for specified position. */ @Nullable public static Integer findPositionByDate(@NonNull final List calendarItems, final long date) { @@ -258,12 +258,12 @@ public final class CalendarUtils { int shift = calendarItems.get(calendarItems.size() - 1).getEndRange(); final DateTime nextMonthFirstDay = dateTime.plusDays(1); - final int firstFayInNextMonth = nextMonthFirstDay.getDayOfWeek() - 1; - calendarItems.add(new CalendarEmptyItem(shift, shift + (7 - firstFayInNextMonth) - 1)); - shift += 7 - firstFayInNextMonth; + final int firstDayInNextMonth = nextMonthFirstDay.getDayOfWeek() - 1; + calendarItems.add(new CalendarEmptyItem(shift + 1, shift + (7 - firstDayInNextMonth))); + shift += 7 - firstDayInNextMonth + 1; calendarItems.add(new CalendarHeaderItem(nextMonthFirstDay.getMonthOfYear() + 1, shift, shift)); shift += 1; - calendarItems.add(new CalendarEmptyItem(shift, shift + firstFayInNextMonth - 1)); + calendarItems.add(new CalendarEmptyItem(shift, shift + firstDayInNextMonth - 1)); } private CalendarUtils() { From a5c0421e3f3c4af740bf9e969a2bec3dc67f7bb4 Mon Sep 17 00:00:00 2001 From: Ilia Kurtov Date: Mon, 7 Nov 2016 18:11:22 +0300 Subject: [PATCH 2/2] static fix --- .../java/ru/touchin/templates/calendar/CalendarUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java b/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java index c73ff19..138de42 100644 --- a/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java +++ b/src/main/java/ru/touchin/templates/calendar/CalendarUtils.java @@ -59,7 +59,7 @@ public final class CalendarUtils { * @param calendarItems List of {@link CalendarItem} where need to find specific element; * @param position Position of adapter; * @return Position of Header that respond to requested position. - * Returns null if Header or related CalendarItem was not found for specified position. + * Returns null if Header or related CalendarItem was not found for specified position. */ @Nullable public static Integer findPositionOfSelectedMonth(@NonNull final List calendarItems, final long position) { @@ -76,7 +76,7 @@ public final class CalendarUtils { * @param calendarItems List of {@link CalendarItem} where need to find specific element; * @param date Requested date in milliseconds. * @return Position of Calendar cell that that has specific date. - * Returns null if CalendarItem was not found for specified position. + * Returns null if CalendarItem was not found for specified position. */ @Nullable public static Integer findPositionByDate(@NonNull final List calendarItems, final long date) {