diff options
author | Alan Viverette <alanv@google.com> | 2014-08-21 13:56:54 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-08-21 13:56:54 -0700 |
commit | 9468c6a28e696f4ddca2c5b9ba312ffb590c3161 (patch) | |
tree | 086935a7b6d7d49ad4c28adc87b100297fe2939a /core/java | |
parent | aa45ff70a2e41a6308c2dd6c1ff07c722bbdb1a4 (diff) | |
download | frameworks_base-9468c6a28e696f4ddca2c5b9ba312ffb590c3161.zip frameworks_base-9468c6a28e696f4ddca2c5b9ba312ffb590c3161.tar.gz frameworks_base-9468c6a28e696f4ddca2c5b9ba312ffb590c3161.tar.bz2 |
Clean up nullable listeners in date and time picker delegates
Removes the NO_OP listener from TimePicker since we actually do null
checks everywhere already.
BUG: 17179502
Change-Id: I39a7d68253845c004027e31c59afc43be42195b7
Diffstat (limited to 'core/java')
-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)); |