Loading core/java/android/widget/DayPickerPagerAdapter.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -186,11 +186,12 @@ class DayPickerPagerAdapter extends PagerAdapter { } } private int getMonthForPosition(int position) { private int getMonthForPosition(int position) { return position % MONTHS_IN_YEAR + mMinDate.get(Calendar.MONTH); return (position + mMinDate.get(Calendar.MONTH)) % MONTHS_IN_YEAR; } } private int getYearForPosition(int position) { private int getYearForPosition(int position) { return position / MONTHS_IN_YEAR + mMinDate.get(Calendar.YEAR); final int yearOffset = (position + mMinDate.get(Calendar.MONTH)) / MONTHS_IN_YEAR; return yearOffset + mMinDate.get(Calendar.YEAR); } } private int getPositionForDay(@Nullable Calendar day) { private int getPositionForDay(@Nullable Calendar day) { Loading @@ -198,8 +199,8 @@ class DayPickerPagerAdapter extends PagerAdapter { return -1; return -1; } } final int yearOffset = (day.get(Calendar.YEAR) - mMinDate.get(Calendar.YEAR)); final int yearOffset = day.get(Calendar.YEAR) - mMinDate.get(Calendar.YEAR); final int monthOffset = (day.get(Calendar.MONTH) - mMinDate.get(Calendar.MONTH)); final int monthOffset = day.get(Calendar.MONTH) - mMinDate.get(Calendar.MONTH); final int position = yearOffset * MONTHS_IN_YEAR + monthOffset; final int position = yearOffset * MONTHS_IN_YEAR + monthOffset; return position; return position; } } Loading core/java/android/widget/DayPickerView.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -176,8 +176,6 @@ class DayPickerView extends ViewGroup { } } } } }); }); updateButtonVisibility(mViewPager.getCurrentItem()); } } private void updateButtonVisibility(int position) { private void updateButtonVisibility(int position) { Loading Loading @@ -346,6 +344,8 @@ class DayPickerView extends ViewGroup { // Changing the min/max date changes the selection position since we // Changing the min/max date changes the selection position since we // don't really have stable IDs. Jumps immediately to the new position. // don't really have stable IDs. Jumps immediately to the new position. setDate(mSelectedDay.getTimeInMillis(), false, false); setDate(mSelectedDay.getTimeInMillis(), false, false); updateButtonVisibility(mViewPager.getCurrentItem()); } } /** /** Loading Loading
core/java/android/widget/DayPickerPagerAdapter.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -186,11 +186,12 @@ class DayPickerPagerAdapter extends PagerAdapter { } } private int getMonthForPosition(int position) { private int getMonthForPosition(int position) { return position % MONTHS_IN_YEAR + mMinDate.get(Calendar.MONTH); return (position + mMinDate.get(Calendar.MONTH)) % MONTHS_IN_YEAR; } } private int getYearForPosition(int position) { private int getYearForPosition(int position) { return position / MONTHS_IN_YEAR + mMinDate.get(Calendar.YEAR); final int yearOffset = (position + mMinDate.get(Calendar.MONTH)) / MONTHS_IN_YEAR; return yearOffset + mMinDate.get(Calendar.YEAR); } } private int getPositionForDay(@Nullable Calendar day) { private int getPositionForDay(@Nullable Calendar day) { Loading @@ -198,8 +199,8 @@ class DayPickerPagerAdapter extends PagerAdapter { return -1; return -1; } } final int yearOffset = (day.get(Calendar.YEAR) - mMinDate.get(Calendar.YEAR)); final int yearOffset = day.get(Calendar.YEAR) - mMinDate.get(Calendar.YEAR); final int monthOffset = (day.get(Calendar.MONTH) - mMinDate.get(Calendar.MONTH)); final int monthOffset = day.get(Calendar.MONTH) - mMinDate.get(Calendar.MONTH); final int position = yearOffset * MONTHS_IN_YEAR + monthOffset; final int position = yearOffset * MONTHS_IN_YEAR + monthOffset; return position; return position; } } Loading
core/java/android/widget/DayPickerView.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -176,8 +176,6 @@ class DayPickerView extends ViewGroup { } } } } }); }); updateButtonVisibility(mViewPager.getCurrentItem()); } } private void updateButtonVisibility(int position) { private void updateButtonVisibility(int position) { Loading Loading @@ -346,6 +344,8 @@ class DayPickerView extends ViewGroup { // Changing the min/max date changes the selection position since we // Changing the min/max date changes the selection position since we // don't really have stable IDs. Jumps immediately to the new position. // don't really have stable IDs. Jumps immediately to the new position. setDate(mSelectedDay.getTimeInMillis(), false, false); setDate(mSelectedDay.getTimeInMillis(), false, false); updateButtonVisibility(mViewPager.getCurrentItem()); } } /** /** Loading