[LE Audio] Broadcast Sink UI

- Add dialog for Broadcast and find broadcast source

 - Add Activity for find broadcast source

Bug: 228274114
Test: Manual test
Change-Id: I830efc3514fc42aaa4e53f491ed3a7459bd9bb41
Merged-In: I830efc3514fc42aaa4e53f491ed3a7459bd9bb41
This commit is contained in:
changbetty
2022-03-29 01:14:05 +00:00
parent 31011d591f
commit a7b89ba24b
12 changed files with 650 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?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.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:insetTop="6dp"
android:insetBottom="6dp">
<ripple android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="24dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="24dp"/>
<solid android:color="@android:color/transparent"/>
<stroke android:color="?androidprv:attr/colorAccentPrimaryVariant"
android:width="1dp"
/>
<padding android:left="16dp"
android:top="8dp"
android:right="16dp"
android:bottom="8dp"/>
</shape>
</item>
</ripple>
</inset>

View File

@@ -0,0 +1,99 @@
<?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:id="@+id/entity_header"
style="@style/EntityHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical">
<TextView
android:id="@+id/entity_header_title"
style="@style/TextAppearance.EntityHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:ellipsize="marquee"
android:textDirection="locale"/>
<TextView
android:id="@+id/entity_header_summary"
style="@style/TextAppearance.EntityHeaderSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/bluetooth_find_broadcast_header_top_margin"
android:singleLine="false"
android:ellipsize="marquee"
android:textDirection="locale"/>
<Button
android:id="@+id/button_find_broadcast"
android:layout_width="@dimen/bluetooth_find_broadcast_button_one_size"
android:layout_height="wrap_content"
android:text="@string/bluetooth_find_broadcast"
android:clickable="true"
style="@style/BroadcastActionButton" />
<LinearLayout
android:id="@+id/button_broadcast_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button_leave_broadcast"
android:layout_width="@dimen/bluetooth_find_broadcast_button_two_size"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/bluetooth_find_broadcast_button_leave"
android:clickable="true"
style="@style/BroadcastActionButton" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bluetooth_find_broadcast_button_start_margin">
<Button
android:id="@+id/button_scan_qr_code"
android:layout_width="@dimen/bluetooth_find_broadcast_button_two_size"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/bluetooth_find_broadcast_button_scan"
android:clickable="true"
style="@style/BroadcastActionButton" />
</LinearLayout>
</LinearLayout>
<android.widget.ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="@dimen/bluetooth_find_broadcast_progress_width"
android:layout_height="@dimen/bluetooth_find_broadcast_progress_height"
android:layout_marginTop="@dimen/bluetooth_find_broadcast_progress_margin_top"
android:progressDrawable="@drawable/color_bar_progress"/>
</LinearLayout>

View File

@@ -399,6 +399,15 @@
<dimen name="le_bluetooth_summary_start_margin">20dp</dimen>
<dimen name="le_bluetooth_summary_padding">1.5dp</dimen>
<!-- Header layout of bluetooth find broadcast page -->
<dimen name="bluetooth_find_broadcast_button_one_size">220dp</dimen>
<dimen name="bluetooth_find_broadcast_button_two_size">150dp</dimen>
<dimen name="bluetooth_find_broadcast_button_start_margin">16dp</dimen>
<dimen name="bluetooth_find_broadcast_header_top_margin">4dp</dimen>
<dimen name="bluetooth_find_broadcast_progress_width">155dp</dimen>
<dimen name="bluetooth_find_broadcast_progress_height">4dp</dimen>
<dimen name="bluetooth_find_broadcast_progress_margin_top">8dp</dimen>
<!-- Developer option bluetooth settings dialog -->
<dimen name="developer_option_dialog_margin_start">8dp</dimen>
<dimen name="developer_option_dialog_margin_top">8dp</dimen>

View File

@@ -13496,4 +13496,22 @@
<string name="bluetooth_connect_access_dialog_negative">Don\u2019t connect</string>
<!-- Strings for Dialog connect button -->
<string name="bluetooth_connect_access_dialog_positive">Connect</string>
<!-- BT LE Audio Device: Media Broadcast -->
<!-- The title of the Media Broadcast Dialog [CHAR LIMIT=none] -->
<string name="bluetooth_broadcast_dialog_title">Broadcast</string>
<!-- The message of the Media Broadcast Dialog for finding broadcast [CHAR LIMIT=none] -->
<string name="bluetooth_broadcast_dialog_find_message">Listen to broadcasts that are playing near you</string>
<!-- The message of the Media Broadcast Dialog for broadcast [CHAR LIMIT=none] -->
<string name="bluetooth_broadcast_dialog_broadcast_message">Broadcast media to devices near you, or listen to someone elses broadcast</string>
<!-- The title of the Media Find Broadcast activity [CHAR LIMIT=none] -->
<string name="bluetooth_find_broadcast_title">Broadcasts</string>
<!-- The summary of the Media Find Broadcast activity [CHAR LIMIT=none] -->
<string name="bluetooth_find_broadcast_summary">Listening to</string>
<!-- The Button of the action to find broadcasts [CHAR LIMIT=none] -->
<string name="bluetooth_find_broadcast">Find broadcasts</string>
<!-- The Button of the action to leave the broadcast [CHAR LIMIT=none] -->
<string name="bluetooth_find_broadcast_button_leave">Leave broadcast</string>
<!-- The Button of the action to scan QR code [CHAR LIMIT=none] -->
<string name="bluetooth_find_broadcast_button_scan">Scan QR code</string>
</resources>

View File

@@ -936,4 +936,15 @@
<style name="SimConfirmDialog.ButtonBarStyle" parent="@android:style/Widget.Material.ButtonBar">
<item name="android:paddingEnd">8dp</item>
</style>
<style name="BroadcastActionButton" parent="@android:style/Widget.Material.Button">
<item name="android:background">@drawable/broadcast_button_outline</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">14sp</item>
<item name="android:lineHeight">20sp</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
<item name="android:stateListAnimator">@null</item>
<item name="android:minWidth">0dp</item>
<item name="android:textAllCaps">false</item>
</style>
</resources>

View File

@@ -0,0 +1,35 @@
<?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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/bluetooth_find_broadcast_title">
<com.android.settingslib.widget.LayoutPreference
android:key="bluetooth_find_broadcast_header"
android:layout="@layout/bluetooth_broadcast_entity_header"
android:selectable="false"
settings:allowDividerBelow="true"
settings:searchable="false" />
<PreferenceCategory
android:key="broadcast_source_list"
android:layout="@layout/preference_category_no_label"/>
</PreferenceScreen>