Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ecc7f73 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Announce the date for accessibility using EMMMMdy format" into nyc-mr1-dev

parents 97632afe a770530e
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {

    private SimpleDateFormat mYearFormat;
    private SimpleDateFormat mMonthDayFormat;
    private SimpleDateFormat mAccessibilityEventFormat;


    // Top-level container.
    private ViewGroup mContainer;
@@ -307,6 +309,9 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {
        mMonthDayFormat.setContext(DisplayContext.CAPITALIZATION_FOR_STANDALONE);
        mYearFormat = new SimpleDateFormat("y", locale);

        // Clear out the lazily-initialized accessibility event formatter.
        mAccessibilityEventFormat = null;

        // Update the header text.
        onCurrentDateChanged(false);
    }
@@ -586,7 +591,12 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate {

    @Override
    public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
        event.getText().add(mCurrentDate.getTime().toString());
        if (mAccessibilityEventFormat == null) {
            final String pattern = DateFormat.getBestDateTimePattern(mCurrentLocale, "EMMMMdy");
            mAccessibilityEventFormat = new SimpleDateFormat(pattern);
        }
        final CharSequence text = mAccessibilityEventFormat.format(mCurrentDate.getTime());
        event.getText().add(text);
    }

    public CharSequence getAccessibilityClassName() {