Loading packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt +14 −2 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ constructor( private lateinit var contentView: View private lateinit var doneButton: Button private lateinit var bluetoothToggle: Switch private lateinit var titleTextView: TextView private lateinit var subtitleTextView: TextView private lateinit var seeAllButton: View private lateinit var pairNewDeviceButton: View Loading Loading @@ -163,6 +164,7 @@ constructor( doneButton = contentView.requireViewById(R.id.done_button) bluetoothToggle = contentView.requireViewById(R.id.bluetooth_toggle) titleTextView = contentView.requireViewById(R.id.bluetooth_tile_dialog_title) subtitleTextView = contentView.requireViewById(R.id.bluetooth_tile_dialog_subtitle) seeAllButton = contentView.requireViewById(R.id.see_all_button) pairNewDeviceButton = contentView.requireViewById(R.id.pair_new_device_button) Loading @@ -182,7 +184,15 @@ constructor( setupRecyclerView() setupDoneButton() if (isInDialog) { subtitleTextView.text = contentView.context.getString(initialUiProperties.subTitleResId) } else { // If rendering with tile details view, the title and subtitle will be added in the // `TileDetails` titleTextView.visibility = GONE subtitleTextView.visibility = GONE } seeAllButton.setOnClickListener { onSeeAllClicked(it) } pairNewDeviceButton.setOnClickListener { onPairNewDeviceClicked(it) } audioSharingButton.apply { Loading Loading @@ -332,7 +342,9 @@ constructor( setEnabled(true) alpha = ENABLED_ALPHA } if (isInDialog) { subtitleTextView.text = contentView.context.getString(uiProperties.subTitleResId) } autoOnToggleLayout.visibility = uiProperties.autoOnToggleVisibility } Loading packages/SystemUI/src/com/android/systemui/bluetooth/ui/viewModel/BluetoothDetailsContentViewModel.kt +14 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.view.View.VISIBLE import android.view.ViewGroup import androidx.annotation.DimenRes import androidx.annotation.StringRes import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import com.android.app.tracing.coroutines.launchTraced as launch import com.android.internal.jank.InteractionJankMonitor import com.android.settingslib.volume.domain.interactor.AudioModeInteractor Loading Loading @@ -88,6 +91,12 @@ constructor( private val bluetoothDetailsContentManagerFactory: BluetoothDetailsContentManager.Factory, ) { var title by mutableStateOf("") private set var subTitle by mutableStateOf("") private set lateinit var contentManager: BluetoothDetailsContentManager private var job: Job? = null Loading Loading @@ -183,6 +192,8 @@ constructor( deviceItemInteractor.updateDeviceItems(context, DeviceFetchTrigger.FIRST_LOAD) } title = context.getString(R.string.quick_settings_bluetooth_label) // deviceItemUpdate is emitted when device item list is done fetching, update UI and // stop the progress bar. combine(deviceItemInteractor.deviceItemUpdate, deviceItemInteractor.showSeeAllUpdate) { Loading Loading @@ -257,8 +268,9 @@ constructor( // the device item list. bluetoothStateInteractor.bluetoothStateUpdate .onEach { detailsUIState.bluetoothState.value = BluetoothState(it, UiProperties.build(it, isAutoOnToggleFeatureAvailable())) val uiProperties = UiProperties.build(it, isAutoOnToggleFeatureAvailable()) subTitle = context.getString(uiProperties.subTitleResId) detailsUIState.bluetoothState.value = BluetoothState(it, uiProperties) updateDeviceItemJob?.cancel() updateDeviceItemJob = launch { deviceItemInteractor.updateDeviceItems( Loading packages/SystemUI/src/com/android/systemui/bluetooth/ui/viewModel/BluetoothDetailsViewModel.kt +4 −4 Original line number Diff line number Diff line Loading @@ -26,9 +26,9 @@ class BluetoothDetailsViewModel( onSettingsClick() } // TODO: b/378513956 Update the placeholder text override val title = "Bluetooth" override val title: String get() = detailsContentViewModel.title // TODO: b/378513956 Update the placeholder text override val subTitle = "Tap to connect or disconnect a device" override val subTitle: String get() = detailsContentViewModel.subTitle } packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModelTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -312,4 +312,18 @@ class BluetoothDetailsContentViewModelTest : SysuiTestCase() { assertThat(actual).isFalse() } } @Test fun testUpdateTitleAndSubtitle() { testScope.runTest { assertThat(bluetoothDetailsContentViewModel.title).isEqualTo("") assertThat(bluetoothDetailsContentViewModel.subTitle).isEqualTo("") bluetoothDetailsContentViewModel.showDialog(expandable) runCurrent() assertThat(bluetoothDetailsContentViewModel.title).isEqualTo("Bluetooth") assertThat(bluetoothDetailsContentViewModel.subTitle).isEqualTo("Bluetooth is off") } } } Loading
packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt +14 −2 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ constructor( private lateinit var contentView: View private lateinit var doneButton: Button private lateinit var bluetoothToggle: Switch private lateinit var titleTextView: TextView private lateinit var subtitleTextView: TextView private lateinit var seeAllButton: View private lateinit var pairNewDeviceButton: View Loading Loading @@ -163,6 +164,7 @@ constructor( doneButton = contentView.requireViewById(R.id.done_button) bluetoothToggle = contentView.requireViewById(R.id.bluetooth_toggle) titleTextView = contentView.requireViewById(R.id.bluetooth_tile_dialog_title) subtitleTextView = contentView.requireViewById(R.id.bluetooth_tile_dialog_subtitle) seeAllButton = contentView.requireViewById(R.id.see_all_button) pairNewDeviceButton = contentView.requireViewById(R.id.pair_new_device_button) Loading @@ -182,7 +184,15 @@ constructor( setupRecyclerView() setupDoneButton() if (isInDialog) { subtitleTextView.text = contentView.context.getString(initialUiProperties.subTitleResId) } else { // If rendering with tile details view, the title and subtitle will be added in the // `TileDetails` titleTextView.visibility = GONE subtitleTextView.visibility = GONE } seeAllButton.setOnClickListener { onSeeAllClicked(it) } pairNewDeviceButton.setOnClickListener { onPairNewDeviceClicked(it) } audioSharingButton.apply { Loading Loading @@ -332,7 +342,9 @@ constructor( setEnabled(true) alpha = ENABLED_ALPHA } if (isInDialog) { subtitleTextView.text = contentView.context.getString(uiProperties.subTitleResId) } autoOnToggleLayout.visibility = uiProperties.autoOnToggleVisibility } Loading
packages/SystemUI/src/com/android/systemui/bluetooth/ui/viewModel/BluetoothDetailsContentViewModel.kt +14 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.view.View.VISIBLE import android.view.ViewGroup import androidx.annotation.DimenRes import androidx.annotation.StringRes import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import com.android.app.tracing.coroutines.launchTraced as launch import com.android.internal.jank.InteractionJankMonitor import com.android.settingslib.volume.domain.interactor.AudioModeInteractor Loading Loading @@ -88,6 +91,12 @@ constructor( private val bluetoothDetailsContentManagerFactory: BluetoothDetailsContentManager.Factory, ) { var title by mutableStateOf("") private set var subTitle by mutableStateOf("") private set lateinit var contentManager: BluetoothDetailsContentManager private var job: Job? = null Loading Loading @@ -183,6 +192,8 @@ constructor( deviceItemInteractor.updateDeviceItems(context, DeviceFetchTrigger.FIRST_LOAD) } title = context.getString(R.string.quick_settings_bluetooth_label) // deviceItemUpdate is emitted when device item list is done fetching, update UI and // stop the progress bar. combine(deviceItemInteractor.deviceItemUpdate, deviceItemInteractor.showSeeAllUpdate) { Loading Loading @@ -257,8 +268,9 @@ constructor( // the device item list. bluetoothStateInteractor.bluetoothStateUpdate .onEach { detailsUIState.bluetoothState.value = BluetoothState(it, UiProperties.build(it, isAutoOnToggleFeatureAvailable())) val uiProperties = UiProperties.build(it, isAutoOnToggleFeatureAvailable()) subTitle = context.getString(uiProperties.subTitleResId) detailsUIState.bluetoothState.value = BluetoothState(it, uiProperties) updateDeviceItemJob?.cancel() updateDeviceItemJob = launch { deviceItemInteractor.updateDeviceItems( Loading
packages/SystemUI/src/com/android/systemui/bluetooth/ui/viewModel/BluetoothDetailsViewModel.kt +4 −4 Original line number Diff line number Diff line Loading @@ -26,9 +26,9 @@ class BluetoothDetailsViewModel( onSettingsClick() } // TODO: b/378513956 Update the placeholder text override val title = "Bluetooth" override val title: String get() = detailsContentViewModel.title // TODO: b/378513956 Update the placeholder text override val subTitle = "Tap to connect or disconnect a device" override val subTitle: String get() = detailsContentViewModel.subTitle }
packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModelTest.kt +14 −0 Original line number Diff line number Diff line Loading @@ -312,4 +312,18 @@ class BluetoothDetailsContentViewModelTest : SysuiTestCase() { assertThat(actual).isFalse() } } @Test fun testUpdateTitleAndSubtitle() { testScope.runTest { assertThat(bluetoothDetailsContentViewModel.title).isEqualTo("") assertThat(bluetoothDetailsContentViewModel.subTitle).isEqualTo("") bluetoothDetailsContentViewModel.showDialog(expandable) runCurrent() assertThat(bluetoothDetailsContentViewModel.title).isEqualTo("Bluetooth") assertThat(bluetoothDetailsContentViewModel.subTitle).isEqualTo("Bluetooth is off") } } }