Fix a11y readout of the day toggles in Time Schedule of Modes

Content description (full day name) replaces TextOn/TextOff (day name initial), and the state description no longer has the day name. As a result:
* the initial readout changes from "Monday, off, M, Switch" to "Off, Monday, Switch"
* when toggling, the name of the day is no longer repeated, and just "On/Off" is announced.

Fixes: 370360007
Test: manual, with Talkback
Flag: android.app.modes_ui
Change-Id: I57bbd7034e1af2836582720a7f4871a79d6644ab
This commit is contained in:
Matías Hernández
2024-09-30 17:47:36 +02:00
parent 9b36ed51a2
commit 78367de795

View File

@@ -204,10 +204,10 @@ class ZenModeSetSchedulePreferenceController extends AbstractZenModePreferenceCo
// day label.
dayToggle.setTextOn(mShortDayFormat.format(c.getTime()));
dayToggle.setTextOff(mShortDayFormat.format(c.getTime()));
String state = dayEnabled
? mContext.getString(com.android.internal.R.string.capital_on)
: mContext.getString(com.android.internal.R.string.capital_off);
dayToggle.setStateDescription(mLongDayFormat.format(c.getTime()) + ", " + state);
dayToggle.setContentDescription(mLongDayFormat.format(c.getTime()));
dayToggle.setStateDescription(mContext.getString(dayEnabled
? com.android.internal.R.string.capital_on
: com.android.internal.R.string.capital_off));
dayToggle.setChecked(dayEnabled);
dayToggle.setOnCheckedChangeListener((buttonView, isChecked) -> {