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

Commit 122fca86 authored by Alan Viverette's avatar Alan Viverette Committed by android-build-merger
Browse files

Announce the date for accessibility using EMMMMdy format am: a770530e

am: d2394114

Change-Id: I6c2323d6e17a6497bcab0161d745586feb96076c
parents 53895cf3 d2394114
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() {