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

Commit 206748d1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "A11y: Fix battery icon and clock descriptions" into nyc-dev

parents 50a87185 70dcf839
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -381,6 +381,9 @@
    <!-- Content description of the battery level icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_battery_level">Battery <xliff:g id="number">%d</xliff:g> percent.</string>

    <!-- Content description of the battery level icon for accessibility while the device is charging (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_battery_level_charging">Battery charging, <xliff:g id="battery_percentage">%d</xliff:g> percent.</string>

    <!-- Content description of the button for showing a settings panel in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_settings_button">System settings.</string>

+2 −1
Original line number Diff line number Diff line
@@ -89,7 +89,8 @@ public class BatteryMeterView extends ImageView implements
    @Override
    public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
        setContentDescription(
                getContext().getString(R.string.accessibility_battery_level, level));
                getContext().getString(charging ? R.string.accessibility_battery_level_charging
                        : R.string.accessibility_battery_level, level));
    }

    @Override
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ public class Clock extends TextView implements DemoMode, Tunable {
    private Calendar mCalendar;
    private String mClockFormatString;
    private SimpleDateFormat mClockFormat;
    private SimpleDateFormat mContentDescriptionFormat;
    private Locale mLocale;

    private static final int AM_PM_STYLE_NORMAL  = 0;
@@ -158,6 +159,7 @@ public class Clock extends TextView implements DemoMode, Tunable {
        if (mDemoMode) return;
        mCalendar.setTimeInMillis(System.currentTimeMillis());
        setText(getSmallTime());
        setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime()));
    }

    @Override
@@ -207,6 +209,7 @@ public class Clock extends TextView implements DemoMode, Tunable {
                ? is24 ? d.timeFormat_Hms : d.timeFormat_hms
                : is24 ? d.timeFormat_Hm : d.timeFormat_hm;
        if (!format.equals(mClockFormatString)) {
            mContentDescriptionFormat = new SimpleDateFormat(format);
            /*
             * Search for an unquoted "a" in the format string, so we can
             * add dummy characters around it to let us find it again after
@@ -295,6 +298,7 @@ public class Clock extends TextView implements DemoMode, Tunable {
                mCalendar.set(Calendar.MINUTE, mm);
            }
            setText(getSmallTime());
            setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime()));
        }
    }