Change radio button's default state description to "selected", "not selected"

Per partner request.

Fix: 171507541
Test: tested manually with talkback.

Change-Id: I234281fed476e664cd13bf3079fc706564ad1f3d
This commit is contained in:
yingleiw
2020-09-30 16:58:37 -07:00
parent 0583d29f13
commit 893b7d629d
3 changed files with 22 additions and 2 deletions

View File

@@ -16,10 +16,13 @@
package android.widget;
import android.annotation.NonNull;
import android.content.Context;
import android.util.AttributeSet;
import android.view.accessibility.AccessibilityNodeInfo;
import com.android.internal.R;
/**
* <p>
@@ -98,4 +101,15 @@ public class RadioButton extends CompoundButton {
}
}
}
/** @hide **/
@Override
@NonNull
protected CharSequence getButtonStateDescription() {
if (isChecked()) {
return getResources().getString(R.string.selected);
} else {
return getResources().getString(R.string.not_selected);
}
}
}

View File

@@ -3056,10 +3056,14 @@
<!-- Default text for a button that can be toggled on and off. -->
<string name="capital_off">OFF</string>
<!-- Default state for CompoundButton for on and off. [CHAR LIMIT=32] -->
<!-- Default checked text used by accessibility for a button that can be checked or unchecked. [CHAR LIMIT=NONE] -->
<string name="checked">checked</string>
<!-- Default text for a button that can be toggled on and off. [CHAR LIMIT=32] -->
<!-- Default not checked text used by accessibility for a button that can be checked or unchecked. [CHAR LIMIT=NONE] -->
<string name="not_checked">not checked</string>
<!-- Default selected text used by accessibility for an element that can be selected or unselected. [CHAR LIMIT=NONE] -->
<string name="selected">selected</string>
<!-- Default not selected text used by accessibility for an element that can be selected or unselected. [CHAR LIMIT=NONE] -->
<string name="not_selected">not selected</string>
<!-- Title of intent resolver dialog when selecting an application to run. -->
<string name="whichApplication">Complete action using</string>

View File

@@ -826,6 +826,7 @@
<java-symbol type="string" name="no_file_chosen" />
<java-symbol type="string" name="no_matches" />
<java-symbol type="string" name="noon" />
<java-symbol type="string" name="not_selected" />
<java-symbol type="string" name="number_picker_increment_scroll_action" />
<java-symbol type="string" name="number_picker_increment_scroll_mode" />
<java-symbol type="string" name="old_app_action" />
@@ -959,6 +960,7 @@
<java-symbol type="string" name="save_password_never" />
<java-symbol type="string" name="save_password_notnow" />
<java-symbol type="string" name="save_password_remember" />
<java-symbol type="string" name="selected" />
<java-symbol type="string" name="sendText" />
<java-symbol type="string" name="sending" />
<java-symbol type="string" name="serviceClassData" />