Add accessibility label for "QR code" button in Audio sharing page.

Test: atest
Bug: 354112158
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Change-Id: I5d2e2c70ca76e3598ca3d9550ebcc140d3400e34
This commit is contained in:
chelseahao
2024-07-22 14:17:11 +08:00
parent 5c466c5ba3
commit 8dd7d1cc80
2 changed files with 3 additions and 0 deletions

View File

@@ -92,6 +92,8 @@ public class AudioSharingNamePreference extends ValidatedEditTextPreference {
shareButton.setVisibility(View.VISIBLE); shareButton.setVisibility(View.VISIBLE);
shareButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_qrcode_24dp)); shareButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_qrcode_24dp));
shareButton.setOnClickListener(unused -> launchAudioSharingQrCodeFragment()); shareButton.setOnClickListener(unused -> launchAudioSharingQrCodeFragment());
shareButton.setContentDescription(
getContext().getString(R.string.audio_sharing_qrcode_button_label));
} }
private void configureInvisibleStateForQrCodeIcon(ImageButton shareButton, View divider) { private void configureInvisibleStateForQrCodeIcon(ImageButton shareButton, View divider) {

View File

@@ -117,6 +117,7 @@ public class AudioSharingNamePreferenceTest {
assertThat(shareButton.getVisibility()).isEqualTo(View.VISIBLE); assertThat(shareButton.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(shareButton.getDrawable()).isNotNull(); assertThat(shareButton.getDrawable()).isNotNull();
assertThat(shareButton.hasOnClickListeners()).isTrue(); assertThat(shareButton.hasOnClickListeners()).isTrue();
assertThat(shareButton.getContentDescription()).isNotNull();
assertThat(divider).isNotNull(); assertThat(divider).isNotNull();
assertThat(divider.getVisibility()).isEqualTo(View.VISIBLE); assertThat(divider.getVisibility()).isEqualTo(View.VISIBLE);