Merge changes Ibb68252c,Ide20e07f,I5d2e2c70 into main

* changes:
  Add accessibility label for "QR code" scanner. Also added landscape mode.
  Add accessibility label for "QR code" image. Also added landscape mode.
  Add accessibility label for "QR code" button in Audio sharing page.
This commit is contained in:
Chelsea Hao
2024-07-23 02:52:11 +00:00
committed by Android (Google) Code Review
8 changed files with 150 additions and 3 deletions

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="25dp"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="15sp"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/qrcode_view"
android:layout_width="@dimen/qrcode_size"
android:layout_height="@dimen/qrcode_size"
android:contentDescription="@string/audio_streams_qr_code_page_image_label"
android:focusable="true" />
<TextView
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@android:id/summary"
style="@style/QrCodeScanner"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="center"
android:clipChildren="true"
android:contentDescription="@string/audio_streams_qr_code_scanner_label"
android:focusable="true">
<TextureView
android:id="@+id/preview_view"
android:layout_marginStart="@dimen/qrcode_preview_margin"
android:layout_marginEnd="@dimen/qrcode_preview_margin"
android:layout_width="match_parent"
android:layout_height="@dimen/qrcode_preview_size"/>
</FrameLayout>
<TextView
android:id="@+id/error_message"
style="@style/TextAppearance.ErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:layout_gravity="center"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>

View File

@@ -47,7 +47,9 @@
<ImageView
android:id="@+id/qrcode_view"
android:layout_width="@dimen/qrcode_size"
android:layout_height="@dimen/qrcode_size"/>
android:layout_height="@dimen/qrcode_size"
android:contentDescription="@string/audio_streams_qr_code_page_image_label"
android:focusable="true"/>
<TextView
android:id="@+id/password"

View File

@@ -55,7 +55,9 @@
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="center"
android:clipChildren="true">
android:clipChildren="true"
android:contentDescription="@string/audio_streams_qr_code_scanner_label"
android:focusable="true">
<TextureView
android:id="@+id/preview_view"
android:layout_marginStart="@dimen/qrcode_preview_margin"

View File

@@ -13739,6 +13739,10 @@
<string name="audio_streams_main_page_qr_code_scanner_summary">Scan an audio stream QR code to listen with <xliff:g example="LE headset" id="device_name">%1$s</xliff:g></string>
<!-- Le audio streams password dialog [CHAR LIMIT=NONE] -->
<string name="audio_streams_main_page_password_dialog_cannot_edit">Can\u0027t edit password while sharing. To change the password, first turn off audio sharing.</string>
<!-- Text for audio sharing qrcode image [CHAR LIMIT=none]-->
<string name="audio_streams_qr_code_page_image_label">QR code</string>
<!-- Text for audio sharing qrcode scanner [CHAR LIMIT=none]-->
<string name="audio_streams_qr_code_scanner_label">QR code scanner</string>
<!-- url for learning more about bluetooth audio sharing -->

View File

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

View File

@@ -55,7 +55,7 @@ public class AudioStreamsQrCodeFragment extends InstrumentedFragment {
@Override
public final View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.xml.bluetooth_audio_streams_qr_code, container, false);
return inflater.inflate(R.layout.bluetooth_audio_streams_qr_code, container, false);
}
@Override

View File

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