From bd51b4d0b930f8c64920954f4f9e5033e0001d5e Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Fri, 15 May 2015 14:18:44 -0700 Subject: Return correct year in DayPickerPagerAdapter.getYearForPosition() Previously it wasn't offsetting the position by the min date's month, so it would be off by a year if the min date wasn't in January. Also now updates button visibility whenever the ViewPager's range changes. Bug: 21203303 Change-Id: Id7a41a4fa48843943c744fb0fecd4bebb798cee5 --- core/java/android/widget/DayPickerView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/java/android/widget/DayPickerView.java') diff --git a/core/java/android/widget/DayPickerView.java b/core/java/android/widget/DayPickerView.java index a434317..dc772fb 100644 --- a/core/java/android/widget/DayPickerView.java +++ b/core/java/android/widget/DayPickerView.java @@ -176,8 +176,6 @@ class DayPickerView extends ViewGroup { } } }); - - updateButtonVisibility(mViewPager.getCurrentItem()); } private void updateButtonVisibility(int position) { @@ -346,6 +344,8 @@ class DayPickerView extends ViewGroup { // Changing the min/max date changes the selection position since we // don't really have stable IDs. Jumps immediately to the new position. setDate(mSelectedDay.getTimeInMillis(), false, false); + + updateButtonVisibility(mViewPager.getCurrentItem()); } /** -- cgit v1.1