summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author My Name <luanzhang@google.com> 2025-02-03 12:37:42 -0800
committer My Name <luanzhang@google.com> 2025-02-05 11:31:28 -0800
commite1856419ad877e398977cf63e55a45d8bf803186 (patch)
tree7690864f8ae32e73281bc3af29db62d6978efeac
parent10770a272d5dc4d57beaf4a07c84a76b03de9cca (diff)
Implement bluetooth details content view
Flag: com.android.systemui.qs_tile_detailed_view Test: Manually tested. More screenshot tests will be added later. Change-Id: I56f5f3141c905bf40ea6a41579c706f3213544fc
-rw-r--r--packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileDetails.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java2
7 files changed, 21 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt
index 8bc929985052..710fde5c2130 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt
@@ -24,13 +24,17 @@ import androidx.compose.ui.viewinterop.AndroidView
import com.android.systemui.res.R
@Composable
-fun BluetoothDetailsContent() {
+fun BluetoothDetailsContent(detailsContentViewModel: BluetoothTileDialogViewModel) {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
// Inflate with the existing dialog xml layout
- LayoutInflater.from(context).inflate(R.layout.bluetooth_tile_dialog, null)
- // TODO: b/378513956 - Implement the bluetooth details view
+ val view =
+ LayoutInflater.from(context)
+ .inflate(R.layout.bluetooth_tile_dialog, /* root= */ null)
+ detailsContentViewModel.showDetailsContent(/* expandable= */ null, view)
+ view
},
+ onRelease = { detailsContentViewModel.contentManager.releaseView() },
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt
index 0be28f3c5a97..d873f41309cc 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt
@@ -61,7 +61,7 @@ data class DeviceItemClick(val deviceItem: DeviceItem, val clickedView: View, va
/** View content manager for showing active, connected and saved bluetooth devices. */
class BluetoothDetailsContentManager
@AssistedInject
-internal constructor(
+constructor(
@Assisted private val initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
@Assisted private val cachedContentHeight: Int,
@Assisted private val bluetoothTileDialogCallback: BluetoothTileDialogCallback,
@@ -112,7 +112,7 @@ internal constructor(
private lateinit var scrollViewContent: View
@AssistedFactory
- internal interface Factory {
+ interface Factory {
fun create(
initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
cachedContentHeight: Int,
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt
index ac4d82a95834..44475318a61e 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt
@@ -18,11 +18,12 @@ package com.android.systemui.bluetooth.qsdialog
import com.android.systemui.plugins.qs.TileDetailsViewModel
-class BluetoothDetailsViewModel(onLongClick: () -> Unit) : TileDetailsViewModel() {
- private val _onLongClick = onLongClick
-
+class BluetoothDetailsViewModel(
+ private val onSettingsClick: () -> Unit,
+ val detailsContentViewModel: BluetoothTileDialogViewModel,
+) : TileDetailsViewModel() {
override fun clickOnSettingsButton() {
- _onLongClick()
+ onSettingsClick()
}
override fun getTitle(): String {
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt
index 3e61c45c7f25..ef18589a2bee 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt
@@ -30,7 +30,7 @@ import dagger.assisted.AssistedInject
/** Dialog for showing active, connected and saved bluetooth devices. */
class BluetoothTileDialogDelegate
@AssistedInject
-internal constructor(
+constructor(
@Assisted private val initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
@Assisted private val cachedContentHeight: Int,
@Assisted private val bluetoothTileDialogCallback: BluetoothTileDialogCallback,
@@ -44,7 +44,7 @@ internal constructor(
lateinit var contentManager: BluetoothDetailsContentManager
@AssistedFactory
- internal interface Factory {
+ interface Factory {
fun create(
initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
cachedContentHeight: Int,
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt
index 9492abbeb087..308c9d10db93 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt
@@ -66,7 +66,7 @@ import kotlinx.coroutines.withContext
* by the dialog view.
*/
@SysUISingleton
-internal class BluetoothTileDialogViewModel
+class BluetoothTileDialogViewModel
@Inject
constructor(
private val deviceItemInteractor: DeviceItemInteractor,
@@ -396,7 +396,7 @@ constructor(
else R.string.bt_is_off
}
- internal data class UiProperties(
+ data class UiProperties(
@StringRes val subTitleResId: Int,
val autoOnToggleVisibility: Int,
@DimenRes val scrollViewMinHeightResId: Int,
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileDetails.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileDetails.kt
index 1233a2f285d5..701f44e9981c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileDetails.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileDetails.kt
@@ -125,7 +125,8 @@ private fun MapTileDetailsContent(tileDetailsViewModel: TileDetailsViewModel) {
when (tileDetailsViewModel) {
is InternetDetailsViewModel -> InternetDetailsContent(tileDetailsViewModel)
is ScreenRecordDetailsViewModel -> ScreenRecordDetailsContent(tileDetailsViewModel)
- is BluetoothDetailsViewModel -> BluetoothDetailsContent()
+ is BluetoothDetailsViewModel ->
+ BluetoothDetailsContent(tileDetailsViewModel.detailsContentViewModel)
is ModesDetailsViewModel -> ModesDetailsContent(tileDetailsViewModel)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
index 1cfa6632a8b0..973265c6c9b1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
@@ -133,7 +133,7 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
callback.accept(new BluetoothDetailsViewModel(() -> {
longClick(null);
return null;
- }))
+ }, mDialogViewModel))
);
return true;
}