Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1856419 authored by My Name's avatar My Name
Browse files

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
parent 10770a27
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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() },
    )
}
+2 −2
Original line number Diff line number Diff line
@@ -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,
+5 −4
Original line number Diff line number Diff line
@@ -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 {
+2 −2
Original line number Diff line number Diff line
@@ -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,
+2 −2
Original line number Diff line number Diff line
@@ -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,
Loading