Merge "Add provider name to on/off switch talkback" into main

This commit is contained in:
Becca Hughes
2024-04-08 21:59:37 +00:00
committed by Android (Google) Code Review
2 changed files with 22 additions and 0 deletions

View File

@@ -11107,6 +11107,9 @@
<!-- Title of the warning dialog for enabling the credential provider. [CHAR_LIMIT=NONE] --> <!-- Title of the warning dialog for enabling the credential provider. [CHAR_LIMIT=NONE] -->
<string name="credman_enable_confirmation_message_title">Use %1$s\?</string> <string name="credman_enable_confirmation_message_title">Use %1$s\?</string>
<!-- Content description for credential manager provider on/off switch. [CHAR_LIMIT=NONE] -->
<string name="credman_on_off_switch_content_description">%1$s on/off</string>
<!-- Positive button text for disabling credential manager. [CHAR_LIMIT=30] --> <!-- Positive button text for disabling credential manager. [CHAR_LIMIT=30] -->
<string name="credman_confirmation_turn_off_positive_button">Turn off</string> <string name="credman_confirmation_turn_off_positive_button">Turn off</string>

View File

@@ -1072,6 +1072,22 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
return mChecked; return mChecked;
} }
@Override
public void setTitle(@Nullable CharSequence title) {
super.setTitle(title);
maybeUpdateContentDescription();
}
private void maybeUpdateContentDescription() {
final CharSequence appName = getTitle();
if (mSwitch != null && !TextUtils.isEmpty(appName)) {
mSwitch.setContentDescription(
getContext().getString(
R.string.credman_on_off_switch_content_description, appName));
}
}
public void setPreferenceListener(OnCombiPreferenceClickListener onClickListener) { public void setPreferenceListener(OnCombiPreferenceClickListener onClickListener) {
mOnClickListener = onClickListener; mOnClickListener = onClickListener;
} }
@@ -1094,6 +1110,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
// Store this for later. // Store this for later.
mSwitch = switchView; mSwitch = switchView;
// Update the content description.
maybeUpdateContentDescription();
} }
super.setOnPreferenceClickListener( super.setOnPreferenceClickListener(