From ab3ec4d5e205c4ca17670e7a52200b5d713a970e Mon Sep 17 00:00:00 2001 From: Krunal Patel Date: Sat, 10 Dec 2022 23:09:40 +0530 Subject: [PATCH] Fix sync of volume progress changed by other mediums --- .../com/github/libretube/ui/views/CustomExoPlayerView.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 5ce834441..746af7787 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -416,8 +416,15 @@ internal class CustomExoPlayerView( } private fun updateVolume(distance: Float) { - gestureViewBinding.volumeControlView.visibility = View.VISIBLE val bar = gestureViewBinding.volumeProgressBar + gestureViewBinding.volumeControlView.apply { + if (visibility == View.GONE) { + visibility = View.VISIBLE + // Volume could be changed using other mediums, sync progress + // bar with new value. + bar.progress = audioHelper.getVolumeWithScale(bar.max) + } + } if (bar.progress == 0) { gestureViewBinding.volumeImageView.setImageResource(