calendar position fix

This commit is contained in:
Ilia Kurtov 2016-05-24 11:52:03 +03:00
parent b111111575
commit 53e6185295
1 changed files with 6 additions and 3 deletions

View File

@ -77,13 +77,16 @@ public abstract class CalendarAdapter<TDayViewHolder extends RecyclerView.ViewHo
}
@Nullable
public Integer getPositionToScroll(final boolean beginningOfSelection) {
if (beginningOfSelection && startSelectionPosition != null) {
public Integer getPositionToScroll(final boolean isDeparture) {
if (isDeparture && startSelectionPosition != null) {
return CalendarUtils.findPositionOfSelectedMonth(calendarItems, startSelectionPosition);
}
if (!beginningOfSelection && endSelectionPosition != null) {
if (!isDeparture && endSelectionPosition != null) {
return CalendarUtils.findPositionOfSelectedMonth(calendarItems, endSelectionPosition);
}
if (!isDeparture && startSelectionPosition != null) {
return CalendarUtils.findPositionOfSelectedMonth(calendarItems, startSelectionPosition);
}
return null;
}