merge from open-source master
Change-Id: I66d3db4c9ed3f54ce17a8d64ca0c6cce6941cdaa
This commit is contained in:
@@ -94,9 +94,7 @@ public class DatePicker extends FrameLayout {
|
||||
mDayPicker.setOnChangeListener(new OnChangedListener() {
|
||||
public void onChanged(NumberPicker picker, int oldVal, int newVal) {
|
||||
mDay = newVal;
|
||||
if (mOnDateChangedListener != null) {
|
||||
mOnDateChangedListener.onDateChanged(DatePicker.this, mYear, mMonth, mDay);
|
||||
}
|
||||
notifyDateChanged();
|
||||
}
|
||||
});
|
||||
mMonthPicker = (NumberPicker) findViewById(R.id.month);
|
||||
@@ -126,9 +124,7 @@ public class DatePicker extends FrameLayout {
|
||||
mMonth = newVal - 1;
|
||||
// Adjust max day of the month
|
||||
adjustMaxDay();
|
||||
if (mOnDateChangedListener != null) {
|
||||
mOnDateChangedListener.onDateChanged(DatePicker.this, mYear, mMonth, mDay);
|
||||
}
|
||||
notifyDateChanged();
|
||||
updateDaySpinner();
|
||||
}
|
||||
});
|
||||
@@ -139,9 +135,7 @@ public class DatePicker extends FrameLayout {
|
||||
mYear = newVal;
|
||||
// Adjust max day for leap years if needed
|
||||
adjustMaxDay();
|
||||
if (mOnDateChangedListener != null) {
|
||||
mOnDateChangedListener.onDateChanged(DatePicker.this, mYear, mMonth, mDay);
|
||||
}
|
||||
notifyDateChanged();
|
||||
updateDaySpinner();
|
||||
}
|
||||
});
|
||||
@@ -242,11 +236,14 @@ public class DatePicker extends FrameLayout {
|
||||
}
|
||||
|
||||
public void updateDate(int year, int monthOfYear, int dayOfMonth) {
|
||||
mYear = year;
|
||||
mMonth = monthOfYear;
|
||||
mDay = dayOfMonth;
|
||||
updateSpinners();
|
||||
reorderPickers(new DateFormatSymbols().getShortMonths());
|
||||
if (mYear != year || mMonth != monthOfYear || mDay != dayOfMonth) {
|
||||
mYear = year;
|
||||
mMonth = monthOfYear;
|
||||
mDay = dayOfMonth;
|
||||
updateSpinners();
|
||||
reorderPickers(new DateFormatSymbols().getShortMonths());
|
||||
notifyDateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private static class SavedState extends BaseSavedState {
|
||||
@@ -388,4 +385,10 @@ public class DatePicker extends FrameLayout {
|
||||
mDay = max;
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyDateChanged() {
|
||||
if (mOnDateChangedListener != null) {
|
||||
mOnDateChangedListener.onDateChanged(DatePicker.this, mYear, mMonth, mDay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user