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

Commit 0d1d0cc0 authored by Alexandr Shabalin's avatar Alexandr Shabalin Committed by Android (Google) Code Review
Browse files

Merge "Set the `stateDescription` for device list items in the CONNECTED state." into main

parents bf9eb756 8ba1e692
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ class MediaOutputAdapterTest : SysuiTestCase() {
            assertThat(mTitleText.visibility).isEqualTo(VISIBLE)
            assertThat(mTitleText.text.toString()).isEqualTo(TEST_DEVICE_NAME_2)
            assertThat(mSlider.visibility).isEqualTo(GONE)
            assertThat(mMainContent.stateDescription).isNull()
        }
    }

@@ -179,6 +180,8 @@ class MediaOutputAdapterTest : SysuiTestCase() {
            assertThat(mTitleText.visibility).isEqualTo(VISIBLE)
            assertThat(mTitleText.text.toString()).isEqualTo(TEST_DEVICE_NAME_1)
            assertThat(mSlider.visibility).isEqualTo(VISIBLE)
            assertThat(mMainContent.stateDescription.toString())
                .isEqualTo(mContext.getString(R.string.media_output_item_connected_state))
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -3341,8 +3341,8 @@
    <string name="media_output_dialog_single_device">1 device selected</string>
    <!-- Summary for media output group with the active device count [CHAR LIMIT=NONE] -->
    <string name="media_output_dialog_multiple_devices"><xliff:g id="count" example="2">%1$d</xliff:g> devices selected</string>
    <!-- Summary for disconnected status [CHAR LIMIT=50] -->
    <string name="media_output_dialog_disconnected">(disconnected)</string>
    <!-- Accessibility label for media output item connected state [CHAR LIMIT=50] -->
    <string name="media_output_item_connected_state">Connected</string>
    <!-- Summary for connecting error message [CHAR LIMIT=NONE] -->
    <string name="media_output_dialog_connect_failed">Can\'t switch. Tap to try again.</string>
    <!-- Title for connecting item [CHAR LIMIT=60] -->
+12 −1
Original line number Diff line number Diff line
@@ -263,6 +263,7 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
            updateDeviceStatusIcon(deviceStatusIcon, colorTheme)
            updateContentBackground(fixedVolumeConnected, colorTheme)
            updateContentClickListener(clickListener)
            updateContentStateDescription(connectionState)
        }

        override fun renderDeviceGroupItem() {
@@ -270,7 +271,9 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
            val colorTheme = ColorTheme()
            updateItemBackground()
            updateTitle(
                title = mController.sessionName ?: "",
                title =
                    mController.sessionName
                        ?: mContext.getString(R.string.media_output_dialog_group),
                connectionState = CONNECTED,
                colorTheme = colorTheme,
            )
@@ -602,6 +605,14 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
            }
        }

        private fun updateContentStateDescription(connectionState: ConnectionState) {
            mMainContent.stateDescription =
                when (connectionState) {
                    CONNECTED -> mContext.getString(R.string.media_output_item_connected_state)
                    else -> null
                }
        }

        override fun disableSeekBar() {
            mSlider.isEnabled = false
        }