diff options
-rw-r--r-- | core/java/android/widget/DatePickerCalendarDelegate.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/TimePickerClockDelegate.java | 12 |
2 files changed, 3 insertions, 13 deletions
diff --git a/core/java/android/widget/DatePickerCalendarDelegate.java b/core/java/android/widget/DatePickerCalendarDelegate.java index f4a478a..49d47fe 100644 --- a/core/java/android/widget/DatePickerCalendarDelegate.java +++ b/core/java/android/widget/DatePickerCalendarDelegate.java @@ -386,7 +386,9 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mCurrentDate.set(Calendar.YEAR, year); mCurrentDate.set(Calendar.MONTH, month); mCurrentDate.set(Calendar.DAY_OF_MONTH, dayOfMonth); - mDateChangedListener.onDateChanged(mDelegator, year, month, dayOfMonth); + if (mDateChangedListener != null) { + mDateChangedListener.onDateChanged(mDelegator, year, month, dayOfMonth); + } updateDisplay(false); } diff --git a/core/java/android/widget/TimePickerClockDelegate.java b/core/java/android/widget/TimePickerClockDelegate.java index 376e5b4..1b89179 100644 --- a/core/java/android/widget/TimePickerClockDelegate.java +++ b/core/java/android/widget/TimePickerClockDelegate.java @@ -73,16 +73,6 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { private boolean mHourWithTwoDigit; private char mHourFormat; - /** - * A no-op callback used in the constructor to avoid null checks later in - * the code. - */ - private static final TimePicker.OnTimeChangedListener NO_OP_CHANGE_LISTENER = - new TimePicker.OnTimeChangedListener() { - public void onTimeChanged(TimePicker view, int hourOfDay, int minute) { - } - }; - public TimePickerClockDelegate(TimePicker delegator, Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(delegator, context); @@ -216,8 +206,6 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { updateMinuteControl(); updateAmPmControl(); - setOnTimeChangedListener(NO_OP_CHANGE_LISTENER); - // set to current time setCurrentHour(mTempCalendar.get(Calendar.HOUR_OF_DAY)); setCurrentMinute(mTempCalendar.get(Calendar.MINUTE)); |