Loading res/layout/le_audio_bt_entity_header.xml 0 → 100644 +137 −0 Original line number Diff line number Diff line <?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:layout_centerHorizontal="true" android:gravity="center_horizontal" 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:layout_gravity="center_horizontal" 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_gravity="center_horizontal" android:layout_marginTop="4dp" android:singleLine="false" android:ellipsize="marquee" android:textDirection="locale"/> <ImageView android:id="@+id/entity_header_icon" android:layout_width="72dp" android:layout_height="72dp" android:layout_marginTop="24dp" android:scaleType="fitCenter" android:antialias="true"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_vertical" android:orientation="horizontal"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/le_bluetooth_battery_start_margin" android:orientation="vertical"> <TextView android:id="@+id/bt_battery_case_title" style="@style/TextAppearance.EntityHeaderTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:gravity="start|center_vertical" android:ellipsize="end" android:textDirection="locale" android:text="@string/bluetooth_middle_name" android:textSize="@dimen/advanced_bluetooth_header_title_text_size" android:visibility="gone"/> <TextView android:id="@+id/bt_battery_left_title" style="@style/TextAppearance.EntityHeaderTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:gravity="start|center_vertical" android:ellipsize="end" android:textDirection="locale" android:text="@string/bluetooth_left_name" android:textSize="@dimen/advanced_bluetooth_header_title_text_size"/> <TextView android:id="@+id/bt_battery_right_title" style="@style/TextAppearance.EntityHeaderTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:gravity="start|center_vertical" android:ellipsize="end" android:textDirection="locale" android:text="@string/bluetooth_right_name" android:textSize="@dimen/advanced_bluetooth_header_title_text_size"/> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/le_bluetooth_summary_start_margin" android:orientation="vertical"> <TextView android:id="@+id/bt_battery_case_summary" style="@style/TextAppearance.EntityHeaderSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:padding="@dimen/le_bluetooth_summary_padding" android:drawablePadding="@dimen/le_bluetooth_summary_drawable_padding" android:visibility="gone"/> <TextView android:id="@+id/bt_battery_left_summary" style="@style/TextAppearance.EntityHeaderSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:padding="@dimen/le_bluetooth_summary_padding" android:drawablePadding="@dimen/le_bluetooth_summary_drawable_padding"/> <TextView android:id="@+id/bt_battery_right_summary" style="@style/TextAppearance.EntityHeaderSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:padding="@dimen/le_bluetooth_summary_padding" android:drawablePadding="@dimen/le_bluetooth_summary_drawable_padding"/> </LinearLayout> </LinearLayout> </LinearLayout> res/values/dimens.xml +7 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,13 @@ <dimen name="advanced_bluetooth_battery_height">27.5dp</dimen> <dimen name="advanced_bluetooth_battery_right_margin">-4dp</dimen> <!-- Header layout of LE audio bluetooth device at bluretooth device detalis --> <dimen name="le_bluetooth_battery_top_margin">5dp</dimen> <dimen name="le_bluetooth_battery_start_margin">10dp</dimen> <dimen name="le_bluetooth_summary_drawable_padding">6dp</dimen> <dimen name="le_bluetooth_summary_start_margin">20dp</dimen> <dimen name="le_bluetooth_summary_padding">1.5dp</dimen> <!-- Developer option bluetooth settings dialog --> <dimen name="developer_option_dialog_margin_start">8dp</dimen> <dimen name="developer_option_dialog_margin_top">8dp</dimen> Loading res/xml/bluetooth_device_details_fragment.xml +8 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,14 @@ settings:searchable="false" settings:controller="com.android.settings.bluetooth.AdvancedBluetoothDetailsHeaderController"/> <com.android.settingslib.widget.LayoutPreference android:key="le_audio_bluetooth_device_header" android:layout="@layout/le_audio_bt_entity_header" android:selectable="false" settings:allowDividerBelow="true" settings:searchable="false" settings:controller="com.android.settings.bluetooth.LeAudioBluetoothDetailsHeaderController"/> <com.android.settingslib.widget.ActionButtonsPreference android:key="action_buttons" settings:allowDividerBelow="true"/> Loading src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.bluetooth; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.TextUtils; Loading Loading @@ -53,7 +54,10 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController @Override public boolean isAvailable() { return !Utils.isAdvancedDetailsHeader(mCachedDevice.getDevice()); boolean hasLeAudio = mCachedDevice.getConnectableProfiles() .stream() .anyMatch(profile -> profile.getProfileId() == BluetoothProfile.LE_AUDIO); return !Utils.isAdvancedDetailsHeader(mCachedDevice.getDevice()) && !hasLeAudio; } @Override Loading src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,7 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment return; } use(AdvancedBluetoothDetailsHeaderController.class).init(mCachedDevice); use(LeAudioBluetoothDetailsHeaderController.class).init(mCachedDevice, mManager); final BluetoothFeatureProvider featureProvider = FeatureFactory.getFactory( context).getBluetoothFeatureProvider(context); Loading Loading
res/layout/le_audio_bt_entity_header.xml 0 → 100644 +137 −0 Original line number Diff line number Diff line <?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:layout_centerHorizontal="true" android:gravity="center_horizontal" 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:layout_gravity="center_horizontal" 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_gravity="center_horizontal" android:layout_marginTop="4dp" android:singleLine="false" android:ellipsize="marquee" android:textDirection="locale"/> <ImageView android:id="@+id/entity_header_icon" android:layout_width="72dp" android:layout_height="72dp" android:layout_marginTop="24dp" android:scaleType="fitCenter" android:antialias="true"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_vertical" android:orientation="horizontal"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/le_bluetooth_battery_start_margin" android:orientation="vertical"> <TextView android:id="@+id/bt_battery_case_title" style="@style/TextAppearance.EntityHeaderTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:gravity="start|center_vertical" android:ellipsize="end" android:textDirection="locale" android:text="@string/bluetooth_middle_name" android:textSize="@dimen/advanced_bluetooth_header_title_text_size" android:visibility="gone"/> <TextView android:id="@+id/bt_battery_left_title" style="@style/TextAppearance.EntityHeaderTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:gravity="start|center_vertical" android:ellipsize="end" android:textDirection="locale" android:text="@string/bluetooth_left_name" android:textSize="@dimen/advanced_bluetooth_header_title_text_size"/> <TextView android:id="@+id/bt_battery_right_title" style="@style/TextAppearance.EntityHeaderTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:gravity="start|center_vertical" android:ellipsize="end" android:textDirection="locale" android:text="@string/bluetooth_right_name" android:textSize="@dimen/advanced_bluetooth_header_title_text_size"/> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/le_bluetooth_summary_start_margin" android:orientation="vertical"> <TextView android:id="@+id/bt_battery_case_summary" style="@style/TextAppearance.EntityHeaderSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:padding="@dimen/le_bluetooth_summary_padding" android:drawablePadding="@dimen/le_bluetooth_summary_drawable_padding" android:visibility="gone"/> <TextView android:id="@+id/bt_battery_left_summary" style="@style/TextAppearance.EntityHeaderSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:padding="@dimen/le_bluetooth_summary_padding" android:drawablePadding="@dimen/le_bluetooth_summary_drawable_padding"/> <TextView android:id="@+id/bt_battery_right_summary" style="@style/TextAppearance.EntityHeaderSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/le_bluetooth_battery_top_margin" android:padding="@dimen/le_bluetooth_summary_padding" android:drawablePadding="@dimen/le_bluetooth_summary_drawable_padding"/> </LinearLayout> </LinearLayout> </LinearLayout>
res/values/dimens.xml +7 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,13 @@ <dimen name="advanced_bluetooth_battery_height">27.5dp</dimen> <dimen name="advanced_bluetooth_battery_right_margin">-4dp</dimen> <!-- Header layout of LE audio bluetooth device at bluretooth device detalis --> <dimen name="le_bluetooth_battery_top_margin">5dp</dimen> <dimen name="le_bluetooth_battery_start_margin">10dp</dimen> <dimen name="le_bluetooth_summary_drawable_padding">6dp</dimen> <dimen name="le_bluetooth_summary_start_margin">20dp</dimen> <dimen name="le_bluetooth_summary_padding">1.5dp</dimen> <!-- Developer option bluetooth settings dialog --> <dimen name="developer_option_dialog_margin_start">8dp</dimen> <dimen name="developer_option_dialog_margin_top">8dp</dimen> Loading
res/xml/bluetooth_device_details_fragment.xml +8 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,14 @@ settings:searchable="false" settings:controller="com.android.settings.bluetooth.AdvancedBluetoothDetailsHeaderController"/> <com.android.settingslib.widget.LayoutPreference android:key="le_audio_bluetooth_device_header" android:layout="@layout/le_audio_bt_entity_header" android:selectable="false" settings:allowDividerBelow="true" settings:searchable="false" settings:controller="com.android.settings.bluetooth.LeAudioBluetoothDetailsHeaderController"/> <com.android.settingslib.widget.ActionButtonsPreference android:key="action_buttons" settings:allowDividerBelow="true"/> Loading
src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.settings.bluetooth; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.TextUtils; Loading Loading @@ -53,7 +54,10 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController @Override public boolean isAvailable() { return !Utils.isAdvancedDetailsHeader(mCachedDevice.getDevice()); boolean hasLeAudio = mCachedDevice.getConnectableProfiles() .stream() .anyMatch(profile -> profile.getProfileId() == BluetoothProfile.LE_AUDIO); return !Utils.isAdvancedDetailsHeader(mCachedDevice.getDevice()) && !hasLeAudio; } @Override Loading
src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,7 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment return; } use(AdvancedBluetoothDetailsHeaderController.class).init(mCachedDevice); use(LeAudioBluetoothDetailsHeaderController.class).init(mCachedDevice, mManager); final BluetoothFeatureProvider featureProvider = FeatureFactory.getFactory( context).getBluetoothFeatureProvider(context); Loading