[Android] Equalizer bar new getValue API

Nicolas Pomepuy git at videolan.org
Wed Feb 23 12:49:54 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Feb 23 11:15:46 2022 +0100| [4dffef7d530ee6d856ebe1224304c2893b6bfdd5] | committer: Nicolas Pomepuy

Equalizer bar new getValue API

> https://code.videolan.org/videolan/vlc-android/commit/4dffef7d530ee6d856ebe1224304c2893b6bfdd5
---

 .../vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt    | 3 +--
 application/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.kt  | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
index c42ff060f..b2687be23 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.kt
@@ -258,8 +258,7 @@ class EqualizerFragment : VLCBottomSheetDialogFragment(), Slider.OnChangeListene
 
                     if (binding.equalizerButton.isChecked) {
 
-                        val newValue = (eqBandsViews[i].getProgress() - EqualizerBar.RANGE) / EqualizerBar.PRECISION.toFloat()
-                        equalizer.setAmp(i, newValue)
+                        equalizer.setAmp(i, eqBandsViews[i].getValue())
                     }
 
                 }
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.kt b/application/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.kt
index 7ef519da7..1e6671d6c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/view/EqualizerBar.kt
@@ -108,6 +108,8 @@ class EqualizerBar : LinearLayout {
         updateValueText()
     }
 
+    fun getValue() = ((verticalSeekBar.progress - RANGE) / PRECISION.toFloat())
+
     fun setListener(listener: OnEqualizerBarChangeListener?) {
         this.listener = listener
     }



More information about the Android mailing list