Loading core/java/android/widget/DatePickerCalendarDelegate.java +35 −64 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.widget; import android.animation.Keyframe; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; Loading Loading @@ -60,10 +57,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i private static final int DEFAULT_START_YEAR = 1900; private static final int DEFAULT_END_YEAR = 2100; private static final int PULSE_ANIMATOR_DURATION = 544; private static final int ANIMATION_DURATION = 300; private static final int ANIMATION_DELAY = 650; private static final int MONTH_INDEX = 0; private static final int DAY_INDEX = 1; Loading @@ -73,8 +67,13 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i private SimpleDateFormat mDayFormat = new SimpleDateFormat("d", Locale.getDefault()); private TextView mDayOfWeekView; private LinearLayout mDateLayout; /** Layout that contains the current month, day, and year. */ private LinearLayout mMonthDayYearLayout; /** Clickable layout that contains the current day and year. */ private LinearLayout mMonthAndDayLayout; private TextView mHeaderMonthTextView; private TextView mHeaderDayOfMonthTextView; private TextView mHeaderYearTextView; Loading @@ -93,8 +92,6 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i private DatePicker.OnDateChangedListener mDateChangedListener; private boolean mDelayAnimation = true; private int mCurrentView = UNINITIALIZED; private Calendar mCurrentDate; Loading @@ -112,7 +109,6 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mMinDate = getCalendarForLocale(mMinDate, locale); mMaxDate = getCalendarForLocale(mMaxDate, locale); mTempDate = getCalendarForLocale(mMaxDate, locale); mCurrentDate = getCalendarForLocale(mCurrentDate, locale); mMinDate.set(DEFAULT_START_YEAR, 1, 1); Loading @@ -129,7 +125,12 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mDelegator.addView(mainView); mDayOfWeekView = (TextView) mainView.findViewById(R.id.date_picker_header); mDateLayout = (LinearLayout) mainView.findViewById(R.id.day_picker_selector_layout); // Layout that contains the current date and day name header. final LinearLayout dateLayout = (LinearLayout) mainView.findViewById( R.id.day_picker_selector_layout); mMonthDayYearLayout = (LinearLayout) mainView.findViewById( R.id.date_picker_month_day_year_layout); mMonthAndDayLayout = (LinearLayout) mainView.findViewById( R.id.date_picker_month_and_day_layout); mMonthAndDayLayout.setOnClickListener(this); Loading @@ -156,7 +157,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i R.styleable.DatePicker_headerSelectedTextColor, defaultHighlightColor); final int headerBackgroundColor = a.getColor(R.styleable.DatePicker_headerBackgroundColor, Color.TRANSPARENT); mDateLayout.setBackgroundColor(headerBackgroundColor); dateLayout.setBackgroundColor(headerBackgroundColor); final int monthTextAppearanceResId = a.getResourceId( R.styleable.DatePicker_headerMonthTextAppearance, -1); Loading Loading @@ -189,6 +190,10 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mYearPickerView = new YearPickerView(mContext); mYearPickerView.init(this); final int yearSelectedCircleColor = a.getColor(R.styleable.DatePicker_yearListSelectorColor, defaultHighlightColor); mYearPickerView.setYearSelectedCircleColor(yearSelectedCircleColor); final ColorStateList calendarTextColor = a.getColorStateList( R.styleable.DatePicker_calendarTextColor); final int calendarSelectedTextColor = a.getColor( Loading @@ -205,10 +210,12 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mAnimator.addView(mDayPickerView); mAnimator.addView(mYearPickerView); mAnimator.setDateMillis(mCurrentDate.getTimeInMillis()); Animation animation = new AlphaAnimation(0.0f, 1.0f); final Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(ANIMATION_DURATION); mAnimator.setInAnimation(animation); Animation animation2 = new AlphaAnimation(1.0f, 0.0f); final Animation animation2 = new AlphaAnimation(1.0f, 0.0f); animation2.setDuration(ANIMATION_DURATION); mAnimator.setOutAnimation(animation2); Loading Loading @@ -276,30 +283,28 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mDayOfWeekView.setText(mCurrentDate.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault())); } final String bestDateTimePattern = DateFormat.getBestDateTimePattern(mCurrentLocale, "yMMMd"); // Compute indices of Month, Day and Year views int[] viewIndices = getMonthDayYearIndexes(bestDateTimePattern); // Restart from a clean state mMonthAndDayLayout.removeAllViews(); mDateLayout.removeView(mHeaderYearTextView); final String bestDateTimePattern = DateFormat.getBestDateTimePattern(mCurrentLocale, "yMMMd"); final int[] viewIndices = getMonthDayYearIndexes(bestDateTimePattern); // Position the Year View at the correct location // Position the Year and MonthAndDay views within the header. mMonthDayYearLayout.removeAllViews(); if (viewIndices[YEAR_INDEX] == 0) { mDateLayout.addView(mHeaderYearTextView, 1); mMonthDayYearLayout.addView(mHeaderYearTextView); mMonthDayYearLayout.addView(mMonthAndDayLayout); } else { mDateLayout.addView(mHeaderYearTextView, 2); mMonthDayYearLayout.addView(mMonthAndDayLayout); mMonthDayYearLayout.addView(mHeaderYearTextView); } // Position Day and Month Views // Position Day and Month views within the MonthAndDay view. mMonthAndDayLayout.removeAllViews(); if (viewIndices[MONTH_INDEX] > viewIndices[DAY_INDEX]) { // Day View is first mMonthAndDayLayout.addView(mHeaderDayOfMonthTextView); mMonthAndDayLayout.addView(mHeaderMonthTextView); } else { // Month View is first mMonthAndDayLayout.addView(mHeaderMonthTextView); mMonthAndDayLayout.addView(mHeaderDayOfMonthTextView); } Loading Loading @@ -329,12 +334,6 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i switch (viewIndex) { case MONTH_AND_DAY_VIEW: ObjectAnimator pulseAnimator = getPulseAnimator(mMonthAndDayLayout, 0.9f, 1.05f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; } mDayPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayLayout.setSelected(true); Loading @@ -342,19 +341,13 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); int flags = DateUtils.FORMAT_SHOW_DATE; String dayString = DateUtils.formatDateTime(mContext, millis, flags); final int flags = DateUtils.FORMAT_SHOW_DATE; final String dayString = DateUtils.formatDateTime(mContext, millis, flags); mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString); mAnimator.announceForAccessibility(mSelectDay); break; case YEAR_VIEW: pulseAnimator = getPulseAnimator(mHeaderYearTextView, 0.85f, 1.1f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; } mYearPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayLayout.setSelected(false); Loading @@ -362,9 +355,8 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mAnimator.setDisplayedChild(YEAR_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); CharSequence yearString = mYearFormat.format(millis); final CharSequence yearString = mYearFormat.format(millis); mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString); mAnimator.announceForAccessibility(mSelectYear); break; Loading Loading @@ -789,25 +781,4 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i } }; } /** * Render an animator to pulsate a view in place. * @param labelToAnimate the view to pulsate. * @return The animator object. Use .start() to begin. */ public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) { Keyframe k0 = Keyframe.ofFloat(0f, 1f); Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio); Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio); Keyframe k3 = Keyframe.ofFloat(1f, 1f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X, k0, k1, k2, k3); PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, k0, k1, k2, k3); ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY); pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION); return pulseAnimator; } } core/java/android/widget/DayPickerView.java +0 −5 Original line number Diff line number Diff line Loading @@ -73,11 +73,6 @@ class DayPickerView extends ListView implements AbsListView.OnScrollListener, private ScrollStateRunnable mScrollStateChangedRunnable = new ScrollStateRunnable(this); public DayPickerView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public DayPickerView(Context context, DatePickerController controller) { super(context); init(); Loading core/java/android/widget/TimePickerClockDelegate.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.widget; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Parcel; import android.os.Parcelable; Loading @@ -34,6 +33,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import com.android.internal.R; import java.text.DateFormatSymbols; import java.util.Calendar; import java.util.Locale; Loading Loading @@ -149,7 +149,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { mAmPmStrings = getAmPmStrings(context); // am/pm View amPmView = mDelegator.findViewById(R.id.amPm); final View amPmView = mDelegator.findViewById(R.id.amPm); if (amPmView instanceof Button) { mAmPmSpinner = null; mAmPmSpinnerInput = null; Loading core/java/android/widget/TimePickerSpinnerDelegate.java +7 −48 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.widget; import android.animation.Keyframe; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; Loading @@ -43,6 +40,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; import java.text.DateFormatSymbols; import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; Loading Loading @@ -73,12 +71,6 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im private static final int HOURS_IN_HALF_DAY = 12; // Delay in ms before starting the pulse animation private static final int PULSE_ANIMATOR_DELAY = 300; // Duration in ms of the pulse animation private static final int PULSE_ANIMATOR_DURATION = 544; private TextView mHourView; private TextView mMinuteView; private TextView mAmPmTextView; Loading @@ -98,7 +90,6 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im private String mDoublePlaceholderText; private String mDeletedKeyFormat; private boolean mInKbMode; private boolean mIsTimeValid = true; private ArrayList<Integer> mTypedTimes = new ArrayList<Integer>(); private Node mLegalTimesTree; private int mAmKeyCode; Loading Loading @@ -215,14 +206,14 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im mHourView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(HOUR_INDEX, true, false, true); setCurrentItemShowing(HOUR_INDEX, true, true); tryVibrate(); } }); mMinuteView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(MINUTE_INDEX, true, false, true); setCurrentItemShowing(MINUTE_INDEX, true, true); tryVibrate(); } }); Loading @@ -245,7 +236,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im private void updateRadialPicker(int index) { mRadialTimePickerView.initialize(mInitialHourOfDay, mInitialMinute, mIs24HourView); setCurrentItemShowing(index, false, true, true); setCurrentItemShowing(index, false, true); } private int computeMaxWidthOfNumbers(int max) { Loading Loading @@ -633,7 +624,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im updateHeaderHour(newValue, false); String announcement = String.format("%d", newValue); if (mAllowAutoAdvance && autoAdvance) { setCurrentItemShowing(MINUTE_INDEX, true, true, false); setCurrentItemShowing(MINUTE_INDEX, true, false); announcement += ". " + mSelectMinutes; } else { mRadialTimePickerView.setContentDescription( Loading Loading @@ -753,11 +744,9 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im /** * Show either Hours or Minutes. */ private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate, boolean announce) { private void setCurrentItemShowing(int index, boolean animateCircle, boolean announce) { mRadialTimePickerView.setCurrentItemShowing(index, animateCircle); TextView labelToAnimate; if (index == HOUR_INDEX) { int hours = mRadialTimePickerView.getCurrentHour(); if (!mIs24HourView) { Loading @@ -767,24 +756,16 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im if (announce) { mRadialTimePickerView.announceForAccessibility(mSelectHours); } labelToAnimate = mHourView; } else { int minutes = mRadialTimePickerView.getCurrentMinute(); mRadialTimePickerView.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { mRadialTimePickerView.announceForAccessibility(mSelectMinutes); } labelToAnimate = mMinuteView; } mHourView.setSelected(index == HOUR_INDEX); mMinuteView.setSelected(index == MINUTE_INDEX); ObjectAnimator pulseAnimator = getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); } /** Loading Loading @@ -980,7 +961,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im if (!mIs24HourView) { updateAmPmDisplay(hour < 12 ? AM : PM); } setCurrentItemShowing(mRadialTimePickerView.getCurrentItemShowing(), true, true, true); setCurrentItemShowing(mRadialTimePickerView.getCurrentItemShowing(), true, true); onValidationChanged(true); } else { boolean[] enteredZeros = {false, false}; Loading Loading @@ -1289,26 +1270,4 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im return false; } } /** * Render an animator to pulsate a view in place. * * @param labelToAnimate the view to pulsate. * @return The animator object. Use .start() to begin. */ private static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) { final Keyframe k0 = Keyframe.ofFloat(0f, 1f); final Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio); final Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio); final Keyframe k3 = Keyframe.ofFloat(1f, 1f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X, k0, k1, k2, k3); PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, k0, k1, k2, k3); ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY); pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION); return pulseAnimator; } } core/java/android/widget/YearPickerView.java +0 −9 Original line number Diff line number Diff line Loading @@ -70,15 +70,6 @@ class YearPickerView extends ListView implements AdapterView.OnItemClickListener R.dimen.datepicker_year_picker_padding_top); setPadding(0, paddingTop, 0, 0); // Use Theme attributes if possible final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.DatePicker, defStyleAttr, defStyleRes); final int colorResId = a.getResourceId(R.styleable.DatePicker_yearListSelectorColor, R.color.datepicker_default_circle_background_color_holo_light); mYearSelectedCircleColor = res.getColor(colorResId); a.recycle(); setOnItemClickListener(this); setDividerHeight(0); } Loading Loading
core/java/android/widget/DatePickerCalendarDelegate.java +35 −64 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.widget; import android.animation.Keyframe; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; Loading Loading @@ -60,10 +57,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i private static final int DEFAULT_START_YEAR = 1900; private static final int DEFAULT_END_YEAR = 2100; private static final int PULSE_ANIMATOR_DURATION = 544; private static final int ANIMATION_DURATION = 300; private static final int ANIMATION_DELAY = 650; private static final int MONTH_INDEX = 0; private static final int DAY_INDEX = 1; Loading @@ -73,8 +67,13 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i private SimpleDateFormat mDayFormat = new SimpleDateFormat("d", Locale.getDefault()); private TextView mDayOfWeekView; private LinearLayout mDateLayout; /** Layout that contains the current month, day, and year. */ private LinearLayout mMonthDayYearLayout; /** Clickable layout that contains the current day and year. */ private LinearLayout mMonthAndDayLayout; private TextView mHeaderMonthTextView; private TextView mHeaderDayOfMonthTextView; private TextView mHeaderYearTextView; Loading @@ -93,8 +92,6 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i private DatePicker.OnDateChangedListener mDateChangedListener; private boolean mDelayAnimation = true; private int mCurrentView = UNINITIALIZED; private Calendar mCurrentDate; Loading @@ -112,7 +109,6 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mMinDate = getCalendarForLocale(mMinDate, locale); mMaxDate = getCalendarForLocale(mMaxDate, locale); mTempDate = getCalendarForLocale(mMaxDate, locale); mCurrentDate = getCalendarForLocale(mCurrentDate, locale); mMinDate.set(DEFAULT_START_YEAR, 1, 1); Loading @@ -129,7 +125,12 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mDelegator.addView(mainView); mDayOfWeekView = (TextView) mainView.findViewById(R.id.date_picker_header); mDateLayout = (LinearLayout) mainView.findViewById(R.id.day_picker_selector_layout); // Layout that contains the current date and day name header. final LinearLayout dateLayout = (LinearLayout) mainView.findViewById( R.id.day_picker_selector_layout); mMonthDayYearLayout = (LinearLayout) mainView.findViewById( R.id.date_picker_month_day_year_layout); mMonthAndDayLayout = (LinearLayout) mainView.findViewById( R.id.date_picker_month_and_day_layout); mMonthAndDayLayout.setOnClickListener(this); Loading @@ -156,7 +157,7 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i R.styleable.DatePicker_headerSelectedTextColor, defaultHighlightColor); final int headerBackgroundColor = a.getColor(R.styleable.DatePicker_headerBackgroundColor, Color.TRANSPARENT); mDateLayout.setBackgroundColor(headerBackgroundColor); dateLayout.setBackgroundColor(headerBackgroundColor); final int monthTextAppearanceResId = a.getResourceId( R.styleable.DatePicker_headerMonthTextAppearance, -1); Loading Loading @@ -189,6 +190,10 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mYearPickerView = new YearPickerView(mContext); mYearPickerView.init(this); final int yearSelectedCircleColor = a.getColor(R.styleable.DatePicker_yearListSelectorColor, defaultHighlightColor); mYearPickerView.setYearSelectedCircleColor(yearSelectedCircleColor); final ColorStateList calendarTextColor = a.getColorStateList( R.styleable.DatePicker_calendarTextColor); final int calendarSelectedTextColor = a.getColor( Loading @@ -205,10 +210,12 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mAnimator.addView(mDayPickerView); mAnimator.addView(mYearPickerView); mAnimator.setDateMillis(mCurrentDate.getTimeInMillis()); Animation animation = new AlphaAnimation(0.0f, 1.0f); final Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(ANIMATION_DURATION); mAnimator.setInAnimation(animation); Animation animation2 = new AlphaAnimation(1.0f, 0.0f); final Animation animation2 = new AlphaAnimation(1.0f, 0.0f); animation2.setDuration(ANIMATION_DURATION); mAnimator.setOutAnimation(animation2); Loading Loading @@ -276,30 +283,28 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mDayOfWeekView.setText(mCurrentDate.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault())); } final String bestDateTimePattern = DateFormat.getBestDateTimePattern(mCurrentLocale, "yMMMd"); // Compute indices of Month, Day and Year views int[] viewIndices = getMonthDayYearIndexes(bestDateTimePattern); // Restart from a clean state mMonthAndDayLayout.removeAllViews(); mDateLayout.removeView(mHeaderYearTextView); final String bestDateTimePattern = DateFormat.getBestDateTimePattern(mCurrentLocale, "yMMMd"); final int[] viewIndices = getMonthDayYearIndexes(bestDateTimePattern); // Position the Year View at the correct location // Position the Year and MonthAndDay views within the header. mMonthDayYearLayout.removeAllViews(); if (viewIndices[YEAR_INDEX] == 0) { mDateLayout.addView(mHeaderYearTextView, 1); mMonthDayYearLayout.addView(mHeaderYearTextView); mMonthDayYearLayout.addView(mMonthAndDayLayout); } else { mDateLayout.addView(mHeaderYearTextView, 2); mMonthDayYearLayout.addView(mMonthAndDayLayout); mMonthDayYearLayout.addView(mHeaderYearTextView); } // Position Day and Month Views // Position Day and Month views within the MonthAndDay view. mMonthAndDayLayout.removeAllViews(); if (viewIndices[MONTH_INDEX] > viewIndices[DAY_INDEX]) { // Day View is first mMonthAndDayLayout.addView(mHeaderDayOfMonthTextView); mMonthAndDayLayout.addView(mHeaderMonthTextView); } else { // Month View is first mMonthAndDayLayout.addView(mHeaderMonthTextView); mMonthAndDayLayout.addView(mHeaderDayOfMonthTextView); } Loading Loading @@ -329,12 +334,6 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i switch (viewIndex) { case MONTH_AND_DAY_VIEW: ObjectAnimator pulseAnimator = getPulseAnimator(mMonthAndDayLayout, 0.9f, 1.05f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; } mDayPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayLayout.setSelected(true); Loading @@ -342,19 +341,13 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); int flags = DateUtils.FORMAT_SHOW_DATE; String dayString = DateUtils.formatDateTime(mContext, millis, flags); final int flags = DateUtils.FORMAT_SHOW_DATE; final String dayString = DateUtils.formatDateTime(mContext, millis, flags); mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString); mAnimator.announceForAccessibility(mSelectDay); break; case YEAR_VIEW: pulseAnimator = getPulseAnimator(mHeaderYearTextView, 0.85f, 1.1f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; } mYearPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayLayout.setSelected(false); Loading @@ -362,9 +355,8 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i mAnimator.setDisplayedChild(YEAR_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); CharSequence yearString = mYearFormat.format(millis); final CharSequence yearString = mYearFormat.format(millis); mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString); mAnimator.announceForAccessibility(mSelectYear); break; Loading Loading @@ -789,25 +781,4 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i } }; } /** * Render an animator to pulsate a view in place. * @param labelToAnimate the view to pulsate. * @return The animator object. Use .start() to begin. */ public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) { Keyframe k0 = Keyframe.ofFloat(0f, 1f); Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio); Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio); Keyframe k3 = Keyframe.ofFloat(1f, 1f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X, k0, k1, k2, k3); PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, k0, k1, k2, k3); ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY); pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION); return pulseAnimator; } }
core/java/android/widget/DayPickerView.java +0 −5 Original line number Diff line number Diff line Loading @@ -73,11 +73,6 @@ class DayPickerView extends ListView implements AbsListView.OnScrollListener, private ScrollStateRunnable mScrollStateChangedRunnable = new ScrollStateRunnable(this); public DayPickerView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public DayPickerView(Context context, DatePickerController controller) { super(context); init(); Loading
core/java/android/widget/TimePickerClockDelegate.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.widget; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Parcel; import android.os.Parcelable; Loading @@ -34,6 +33,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import com.android.internal.R; import java.text.DateFormatSymbols; import java.util.Calendar; import java.util.Locale; Loading Loading @@ -149,7 +149,7 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate { mAmPmStrings = getAmPmStrings(context); // am/pm View amPmView = mDelegator.findViewById(R.id.amPm); final View amPmView = mDelegator.findViewById(R.id.amPm); if (amPmView instanceof Button) { mAmPmSpinner = null; mAmPmSpinnerInput = null; Loading
core/java/android/widget/TimePickerSpinnerDelegate.java +7 −48 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.widget; import android.animation.Keyframe; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; Loading @@ -43,6 +40,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; import java.text.DateFormatSymbols; import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; Loading Loading @@ -73,12 +71,6 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im private static final int HOURS_IN_HALF_DAY = 12; // Delay in ms before starting the pulse animation private static final int PULSE_ANIMATOR_DELAY = 300; // Duration in ms of the pulse animation private static final int PULSE_ANIMATOR_DURATION = 544; private TextView mHourView; private TextView mMinuteView; private TextView mAmPmTextView; Loading @@ -98,7 +90,6 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im private String mDoublePlaceholderText; private String mDeletedKeyFormat; private boolean mInKbMode; private boolean mIsTimeValid = true; private ArrayList<Integer> mTypedTimes = new ArrayList<Integer>(); private Node mLegalTimesTree; private int mAmKeyCode; Loading Loading @@ -215,14 +206,14 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im mHourView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(HOUR_INDEX, true, false, true); setCurrentItemShowing(HOUR_INDEX, true, true); tryVibrate(); } }); mMinuteView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(MINUTE_INDEX, true, false, true); setCurrentItemShowing(MINUTE_INDEX, true, true); tryVibrate(); } }); Loading @@ -245,7 +236,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im private void updateRadialPicker(int index) { mRadialTimePickerView.initialize(mInitialHourOfDay, mInitialMinute, mIs24HourView); setCurrentItemShowing(index, false, true, true); setCurrentItemShowing(index, false, true); } private int computeMaxWidthOfNumbers(int max) { Loading Loading @@ -633,7 +624,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im updateHeaderHour(newValue, false); String announcement = String.format("%d", newValue); if (mAllowAutoAdvance && autoAdvance) { setCurrentItemShowing(MINUTE_INDEX, true, true, false); setCurrentItemShowing(MINUTE_INDEX, true, false); announcement += ". " + mSelectMinutes; } else { mRadialTimePickerView.setContentDescription( Loading Loading @@ -753,11 +744,9 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im /** * Show either Hours or Minutes. */ private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate, boolean announce) { private void setCurrentItemShowing(int index, boolean animateCircle, boolean announce) { mRadialTimePickerView.setCurrentItemShowing(index, animateCircle); TextView labelToAnimate; if (index == HOUR_INDEX) { int hours = mRadialTimePickerView.getCurrentHour(); if (!mIs24HourView) { Loading @@ -767,24 +756,16 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im if (announce) { mRadialTimePickerView.announceForAccessibility(mSelectHours); } labelToAnimate = mHourView; } else { int minutes = mRadialTimePickerView.getCurrentMinute(); mRadialTimePickerView.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { mRadialTimePickerView.announceForAccessibility(mSelectMinutes); } labelToAnimate = mMinuteView; } mHourView.setSelected(index == HOUR_INDEX); mMinuteView.setSelected(index == MINUTE_INDEX); ObjectAnimator pulseAnimator = getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); } /** Loading Loading @@ -980,7 +961,7 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im if (!mIs24HourView) { updateAmPmDisplay(hour < 12 ? AM : PM); } setCurrentItemShowing(mRadialTimePickerView.getCurrentItemShowing(), true, true, true); setCurrentItemShowing(mRadialTimePickerView.getCurrentItemShowing(), true, true); onValidationChanged(true); } else { boolean[] enteredZeros = {false, false}; Loading Loading @@ -1289,26 +1270,4 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate im return false; } } /** * Render an animator to pulsate a view in place. * * @param labelToAnimate the view to pulsate. * @return The animator object. Use .start() to begin. */ private static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio, float increaseRatio) { final Keyframe k0 = Keyframe.ofFloat(0f, 1f); final Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio); final Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio); final Keyframe k3 = Keyframe.ofFloat(1f, 1f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X, k0, k1, k2, k3); PropertyValuesHolder scaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, k0, k1, k2, k3); ObjectAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(labelToAnimate, scaleX, scaleY); pulseAnimator.setDuration(PULSE_ANIMATOR_DURATION); return pulseAnimator; } }
core/java/android/widget/YearPickerView.java +0 −9 Original line number Diff line number Diff line Loading @@ -70,15 +70,6 @@ class YearPickerView extends ListView implements AdapterView.OnItemClickListener R.dimen.datepicker_year_picker_padding_top); setPadding(0, paddingTop, 0, 0); // Use Theme attributes if possible final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.DatePicker, defStyleAttr, defStyleRes); final int colorResId = a.getResourceId(R.styleable.DatePicker_yearListSelectorColor, R.color.datepicker_default_circle_background_color_holo_light); mYearSelectedCircleColor = res.getColor(colorResId); a.recycle(); setOnItemClickListener(this); setDividerHeight(0); } Loading