diff --git a/packages/SystemUI/res/layout/bluetooth_device_item.xml b/packages/SystemUI/res/layout/bluetooth_device_item.xml index 6d779438ad6cb1af4b6645c0fecaee180a3f27dc..08eccbbe9669fd9f65d5bc620eea9b8867ace1c4 100644 --- a/packages/SystemUI/res/layout/bluetooth_device_item.xml +++ b/packages/SystemUI/res/layout/bluetooth_device_item.xml @@ -44,10 +44,9 @@ android:paddingTop="10dp" android:maxLines="1" android:ellipsize="end" - app:layout_constraintWidth_percent="0.7" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toEndOf="@+id/bluetooth_device_icon" - app:layout_constraintEnd_toStartOf="@+id/gear_icon" + app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintBottom_toTopOf="@+id/bluetooth_device_summary" android:gravity="center_vertical" android:textSize="14sp" /> @@ -60,34 +59,35 @@ android:paddingBottom="10dp" android:maxLines="1" android:ellipsize="end" - app:layout_constraintWidth_percent="0.7" app:layout_constraintTop_toBottomOf="@+id/bluetooth_device_name" app:layout_constraintStart_toEndOf="@+id/bluetooth_device_icon" - app:layout_constraintEnd_toStartOf="@+id/gear_icon" + app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintBottom_toBottomOf="parent" android:gravity="center_vertical" /> + <androidx.constraintlayout.widget.Guideline + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/guideline" + app:layout_constraintGuide_percent="0.8" + android:orientation="vertical"/> + <View android:id="@+id/gear_icon" android:layout_width="0dp" android:layout_height="0dp" android:contentDescription="@string/accessibility_bluetooth_device_settings_gear" - app:layout_constraintStart_toEndOf="@+id/bluetooth_device_name" - app:layout_constraintEnd_toEndOf="@+id/gear_icon_image" + app:layout_constraintStart_toEndOf="@+id/guideline" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> <ImageView android:id="@+id/gear_icon_image" - android:src="@drawable/ic_settings_24dp" - android:contentDescription="@string/accessibility_bluetooth_device_settings_gear" android:layout_width="0dp" android:layout_height="24dp" - app:layout_constraintStart_toEndOf="@+id/bluetooth_device_name" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" + android:src="@drawable/ic_settings_24dp" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintWidth_percent="0.3" - android:gravity="center_vertical" - android:paddingStart="10dp" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml b/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml index 5d986e00deedf8c58d92f87e6cac6a90671f95d3..c11a18b795a1b8d275d12695fca0001aef9d0530 100644 --- a/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml +++ b/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml @@ -51,147 +51,160 @@ android:textAppearance="@style/TextAppearance.Dialog.Body.Message" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintBottom_toTopOf="@id/bluetooth_toggle_title" + app:layout_constraintBottom_toTopOf="@+id/scroll_view" app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_title" /> - <TextView - android:id="@+id/bluetooth_toggle_title" - style="@style/BluetoothTileDialog.Device" - android:layout_width="0dp" - android:layout_height="64dp" - android:maxLines="1" - android:ellipsize="end" - android:gravity="center_vertical" - android:layout_marginTop="4dp" - android:text="@string/turn_on_bluetooth" - android:clickable="false" - android:textAppearance="@style/TextAppearance.Dialog.Body.Message" - android:textSize="16sp" - app:layout_constraintEnd_toStartOf="@+id/bluetooth_toggle" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_subtitle" /> - - <Switch - android:id="@+id/bluetooth_toggle" - style="@style/BluetoothTileDialog.Device" - android:layout_width="0dp" - android:layout_height="48dp" - android:gravity="center|center_vertical" - android:paddingEnd="24dp" - android:layout_marginTop="10dp" - android:contentDescription="@string/turn_on_bluetooth" - android:switchMinWidth="@dimen/settingslib_switch_track_width" - android:theme="@style/MainSwitch.Settingslib" - android:thumb="@drawable/settingslib_thumb_selector" - android:track="@drawable/settingslib_track_selector" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@+id/bluetooth_toggle_title" - app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_subtitle" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/device_list" + <androidx.core.widget.NestedScrollView + android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="20dp" - android:nestedScrollingEnabled="false" - android:overScrollMode="never" - android:scrollbars="vertical" + app:layout_constrainedHeight="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/bluetooth_toggle" - app:layout_constraintBottom_toTopOf="@+id/see_all_text" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_subtitle"> - <androidx.constraintlayout.widget.Group - android:id="@+id/see_all_layout_group" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:visibility="gone" - app:constraint_referenced_ids="ic_arrow,see_all_text" /> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/scroll_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" > - <ImageView - android:id="@+id/ic_arrow" - android:layout_marginStart="36dp" - android:layout_width="24dp" - android:layout_height="24dp" - android:importantForAccessibility="no" - android:gravity="center_vertical" - android:src="@drawable/ic_arrow_forward" - app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/see_all_text" - app:layout_constraintTop_toBottomOf="@id/device_list" /> + <TextView + android:id="@+id/bluetooth_toggle_title" + android:layout_width="0dp" + android:layout_height="64dp" + android:maxLines="1" + android:ellipsize="end" + android:gravity="start|center_vertical" + android:paddingEnd="0dp" + android:paddingStart="36dp" + android:text="@string/turn_on_bluetooth" + android:clickable="false" + android:textAppearance="@style/TextAppearance.Dialog.Body.Message" + android:textSize="16sp" + app:layout_constraintEnd_toStartOf="@+id/bluetooth_toggle" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintBottom_toTopOf="@+id/device_list" + app:layout_constraintTop_toTopOf="parent" /> - <TextView - android:id="@+id/see_all_text" - style="@style/BluetoothTileDialog.Device" - android:layout_width="0dp" - android:layout_height="64dp" - android:maxLines="1" - android:ellipsize="end" - android:gravity="center_vertical" - android:layout_marginStart="0dp" - android:paddingStart="20dp" - android:text="@string/see_all_bluetooth_devices" - android:textSize="14sp" - android:textAppearance="@style/TextAppearance.Dialog.Title" - app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text" - app:layout_constraintStart_toEndOf="@+id/ic_arrow" - app:layout_constraintTop_toBottomOf="@id/device_list" - app:layout_constraintEnd_toEndOf="parent" /> + <Switch + android:id="@+id/bluetooth_toggle" + android:layout_width="wrap_content" + android:layout_height="48dp" + android:gravity="start|center_vertical" + android:paddingEnd="40dp" + android:contentDescription="@string/turn_on_bluetooth" + android:switchMinWidth="@dimen/settingslib_switch_track_width" + android:theme="@style/MainSwitch.Settingslib" + android:thumb="@drawable/settingslib_thumb_selector" + android:track="@drawable/settingslib_track_selector" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/bluetooth_toggle_title" + app:layout_constraintBottom_toTopOf="@+id/device_list" + app:layout_constraintTop_toTopOf="parent" /> - <androidx.constraintlayout.widget.Group - android:id="@+id/pair_new_device_layout_group" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:visibility="gone" - app:constraint_referenced_ids="ic_add,pair_new_device_text" /> + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/device_list" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/bluetooth_toggle" + app:layout_constraintBottom_toTopOf="@+id/see_all_text" /> - <ImageView - android:id="@+id/ic_add" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_marginStart="36dp" - android:gravity="center_vertical" - android:importantForAccessibility="no" - android:src="@drawable/ic_add" - app:layout_constraintBottom_toTopOf="@id/done_button" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/pair_new_device_text" - app:layout_constraintTop_toBottomOf="@id/see_all_text" - android:tint="?android:attr/textColorPrimary" /> + <androidx.constraintlayout.widget.Group + android:id="@+id/see_all_layout_group" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + app:constraint_referenced_ids="ic_arrow,see_all_text" /> - <TextView - android:id="@+id/pair_new_device_text" - style="@style/BluetoothTileDialog.Device" - android:layout_width="0dp" - android:layout_height="64dp" - android:maxLines="1" - android:ellipsize="end" - android:gravity="center_vertical" - android:layout_marginStart="0dp" - android:paddingStart="20dp" - android:text="@string/pair_new_bluetooth_devices" - android:textSize="14sp" - android:textAppearance="@style/TextAppearance.Dialog.Title" - app:layout_constraintBottom_toTopOf="@id/done_button" - app:layout_constraintStart_toEndOf="@+id/ic_add" - app:layout_constraintTop_toBottomOf="@id/see_all_text" - app:layout_constraintEnd_toEndOf="parent" /> + <ImageView + android:id="@+id/ic_arrow" + android:layout_marginStart="36dp" + android:layout_width="24dp" + android:layout_height="24dp" + android:importantForAccessibility="no" + android:gravity="center_vertical" + android:src="@drawable/ic_arrow_forward" + app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/see_all_text" + app:layout_constraintTop_toBottomOf="@id/device_list" /> - <Button - android:id="@+id/done_button" - style="@style/Widget.Dialog.Button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/dialog_bottom_padding" - android:layout_marginEnd="@dimen/dialog_side_padding" - android:layout_marginStart="@dimen/dialog_side_padding" - android:clickable="true" - android:ellipsize="end" - android:focusable="true" - android:maxLines="1" - android:text="@string/inline_done_button" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/pair_new_device_text" /> + <TextView + android:id="@+id/see_all_text" + style="@style/BluetoothTileDialog.Device" + android:layout_width="0dp" + android:layout_height="64dp" + android:maxLines="1" + android:ellipsize="end" + android:gravity="center_vertical" + android:layout_marginStart="0dp" + android:paddingStart="20dp" + android:text="@string/see_all_bluetooth_devices" + android:textSize="14sp" + android:textAppearance="@style/TextAppearance.Dialog.Title" + app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text" + app:layout_constraintStart_toEndOf="@+id/ic_arrow" + app:layout_constraintTop_toBottomOf="@id/device_list" + app:layout_constraintEnd_toEndOf="parent" /> + + <androidx.constraintlayout.widget.Group + android:id="@+id/pair_new_device_layout_group" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + app:constraint_referenced_ids="ic_add,pair_new_device_text" /> + + <ImageView + android:id="@+id/ic_add" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginStart="36dp" + android:gravity="center_vertical" + android:importantForAccessibility="no" + android:src="@drawable/ic_add" + app:layout_constraintBottom_toTopOf="@id/done_button" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/pair_new_device_text" + app:layout_constraintTop_toBottomOf="@id/see_all_text" + android:tint="?android:attr/textColorPrimary" /> + + <TextView + android:id="@+id/pair_new_device_text" + style="@style/BluetoothTileDialog.Device" + android:layout_width="0dp" + android:layout_height="64dp" + android:maxLines="1" + android:ellipsize="end" + android:gravity="center_vertical" + android:layout_marginStart="0dp" + android:paddingStart="20dp" + android:text="@string/pair_new_bluetooth_devices" + android:textSize="14sp" + android:textAppearance="@style/TextAppearance.Dialog.Title" + app:layout_constraintStart_toEndOf="@+id/ic_add" + app:layout_constraintTop_toBottomOf="@id/see_all_text" + app:layout_constraintEnd_toEndOf="parent" /> + + <Button + android:id="@+id/done_button" + style="@style/Widget.Dialog.Button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/dialog_bottom_padding" + android:layout_marginEnd="@dimen/dialog_side_padding" + android:layout_marginStart="@dimen/dialog_side_padding" + android:clickable="true" + android:ellipsize="end" + android:focusable="true" + android:maxLines="1" + android:text="@string/inline_done_button" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/pair_new_device_text" + app:layout_constraintBottom_toBottomOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.core.widget.NestedScrollView> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 4c41ca4153dabac55239fe939ebad8a12dc51429..4c5204447db0430aa0e345541a226ba50ad797ba 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -466,7 +466,7 @@ <string name="accessibility_bluetooth_device_icon">Bluetooth device icon</string> <!-- Content description of the bluetooth device settings gear icon. [CHAR LIMIT=NONE] --> - <string name="accessibility_bluetooth_device_settings_gear">Bluetooth device settings gear</string> + <string name="accessibility_bluetooth_device_settings_gear">Click to configure device detail</string> <!-- Content description of the battery when battery state is unknown for accessibility (not shown on the screen). [CHAR LIMIT=NONE] --> <string name="accessibility_battery_unknown">Battery percentage unknown.</string> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt index 409622615b6cb5a3f2a86abf8001e78d723369c6..7b4b55702f555999e2daa34d3a765accb42269e4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt @@ -78,7 +78,10 @@ constructor( super.onCreate(savedInstanceState) uiEventLogger.log(BluetoothTileDialogUiEvent.BLUETOOTH_TILE_DIALOG_SHOWN) - setContentView(LayoutInflater.from(context).inflate(R.layout.bluetooth_tile_dialog, null)) + LayoutInflater.from(context).inflate(R.layout.bluetooth_tile_dialog, null).apply { + accessibilityPaneTitle = context.getText(R.string.accessibility_desc_quick_settings) + setContentView(this) + } toggleView = requireViewById(R.id.bluetooth_toggle) subtitleTextView = requireViewById(R.id.bluetooth_tile_dialog_subtitle) as TextView @@ -114,14 +117,22 @@ constructor( } internal fun onBluetoothStateUpdated(isEnabled: Boolean, subtitleResId: Int) { - toggleView.isChecked = isEnabled + toggleView.apply { + isChecked = isEnabled + setEnabled(true) + alpha = ENABLED_ALPHA + } subtitleTextView.text = context.getString(subtitleResId) } private fun setupToggle() { toggleView.isChecked = bluetoothToggleInitialValue - toggleView.setOnCheckedChangeListener { _, isChecked -> + toggleView.setOnCheckedChangeListener { view, isChecked -> mutableBluetoothStateToggle.value = isChecked + view.apply { + isEnabled = false + alpha = DISABLED_ALPHA + } logger.logBluetoothState(BluetoothStateStage.USER_TOGGLED, isChecked.toString()) uiEventLogger.log(BluetoothTileDialogUiEvent.BLUETOOTH_TOGGLE_CLICKED) } @@ -225,5 +236,7 @@ constructor( const val ACTION_PREVIOUSLY_CONNECTED_DEVICE = "com.android.settings.PREVIOUSLY_CONNECTED_DEVICE" const val ACTION_PAIR_NEW_DEVICE = "android.settings.BLUETOOTH_PAIRING_SETTINGS" + const val DISABLED_ALPHA = 0.3f + const val ENABLED_ALPHA = 1f } }