Add hint to EditText for Talkback

Set the title as the hint of EditText to fix the missing accessibility
label.

Fix: 386758099
Test: atest DeviceNamePreferenceControllerTest
Flag: EXEMPT bug fix
Change-Id: Icde6796aa3faa3e0ad79611ba2dd0b18b13590a7
This commit is contained in:
Mill Chen
2025-02-13 07:47:32 +00:00
parent a000daad53
commit 5a310e9c8f

View File

@@ -67,6 +67,9 @@ public class ValidatedEditTextPreference extends CustomEditTextPreferenceCompat
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
final EditText editText = view.findViewById(android.R.id.edit);
if (editText != null) {
editText.setHint(getDialogTitle());
}
if (editText != null && !TextUtils.isEmpty(editText.getText())) {
editText.setSelection(editText.getText().length());
}