mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Restrict the waveform seek bar progress value to a 0..1 range.
This commit is contained in:
parent
793e6bf10f
commit
091847b131
@ -13,6 +13,7 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewConfiguration
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.core.math.MathUtils
|
||||
import network.loki.messenger.R
|
||||
import java.lang.Math.abs
|
||||
import kotlin.math.max
|
||||
@ -227,11 +228,11 @@ class WaveformSeekBar : View {
|
||||
}
|
||||
|
||||
private fun updateProgress(progress: Float, notify: Boolean) {
|
||||
_progress = progress
|
||||
_progress = MathUtils.clamp(progress, 0f, 1f)
|
||||
invalidate()
|
||||
|
||||
if (notify) {
|
||||
progressChangeListener?.onProgressChanged(this, progress, true)
|
||||
progressChangeListener?.onProgressChanged(this, _progress, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user