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

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

Merge "Always update mute icon along with slider value." into main

parents 029b21d6 629a9cbc
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -384,10 +384,19 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
            }
        }

        private fun initializeSeekbarVolume(currentVolume: Int) {
        private fun initializeSeekbarVolume(
            currentVolume: Int,
            deviceDrawable: Drawable?,
            muteDrawable: Drawable?,
        ) {
            tryResolveVolumeUserRequest(currentVolume)
            if (!isDragging && hasNoPendingVolumeRequests()) {
                mSlider.value = currentVolume.toFloat()
                updateSliderIconsVisibility(
                    deviceDrawable = deviceDrawable,
                    muteDrawable = muteDrawable,
                    isMuted = currentVolume == 0,
                )
            }
        }

@@ -432,12 +441,11 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
            mSlider.trackIconInactiveColor =
                ColorStateList.valueOf(colorTheme.sliderInactiveIconColor)
            val muteDrawable = getMuteDrawable(isInputDevice)
            updateSliderIconsVisibility(
            initializeSeekbarVolume(
                currentVolume = currentVolume,
                deviceDrawable = deviceDrawable,
                muteDrawable = muteDrawable,
                isMuted = currentVolume == 0,
            )
            initializeSeekbarVolume(currentVolume)

            mSlider.clearOnChangeListeners() // Prevent adding multiple listeners
            mSlider.addOnChangeListener { _: Slider, value: Float, fromUser: Boolean ->