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

Commit 5a881e3b authored by Andrew Sapperstein's avatar Andrew Sapperstein
Browse files

Move device icon to end of volume slider.

Bug: 420582132
Fixes: 420582132
Test: manual inspection
Test: atest com.android.systemui.media.dialog.MediaOutputAdapterScreenshotTest
Flag: EXEMPT bugfix
Change-Id: Id28badbee827ccbb243c0d55a81c33568ac26961
parent d8c270d9
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
                updateSliderIconsVisibility(
                    deviceDrawable = deviceDrawable,
                    muteDrawable = muteDrawable,
                    isMuted = currentVolume == 0,
                    sliderVolume = currentVolume,
                )
                mSlider.stateDescription = getSliderStateDescription()
            }
@@ -463,7 +463,7 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
                    updateSliderIconsVisibility(
                        deviceDrawable = deviceDrawable,
                        muteDrawable = muteDrawable,
                        isMuted = seekBarVolume == 0,
                        sliderVolume = seekBarVolume,
                    )
                    if (seekBarVolume != currentVolume) {
                        setLatestVolumeRequest(seekBarVolume)
@@ -503,12 +503,11 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
        private fun updateSliderIconsVisibility(
            deviceDrawable: Drawable?,
            muteDrawable: Drawable?,
            isMuted: Boolean,
            sliderVolume: Int,
        ) {
            mSlider.trackIconInactiveStart = if (isMuted) muteDrawable else null
            // A workaround for the slider glitch that sometimes shows the active icon in inactive
            // state.
            mSlider.trackIconActiveStart = if (isMuted) null else deviceDrawable
            mSlider.trackIconInactiveEnd = if (sliderVolume == 0) muteDrawable else deviceDrawable
            mSlider.trackIconActiveEnd =
                if (sliderVolume == mSlider.valueTo.toInt()) deviceDrawable else null
        }

        private fun updateTitleIcon(