From 21f239e8570e556d483a2f1bb828a6ccf6ed3137 Mon Sep 17 00:00:00 2001 From: Erick Chang Date: Tue, 31 May 2016 12:29:39 -0400 Subject: [PATCH] Fix current month not updating if min date is set to a month after the current month --- .../materialcalendarview/MaterialCalendarView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java b/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java index 05635f4c..9742b725 100644 --- a/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java +++ b/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java @@ -1095,6 +1095,9 @@ private void setRangeDates(CalendarDay min, CalendarDay max) { CalendarDay c = currentMonth; adapter.setRangeDates(min, max); currentMonth = c; + if (min != null) { + currentMonth = min.isAfter(currentMonth) ? min : currentMonth; + } int position = adapter.getIndexForDay(c); pager.setCurrentItem(position, false); updateUi();