mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Message audio view is no longer seekable when it's uploading.
This commit is contained in:
parent
018e3288a4
commit
6a93653080
@ -96,6 +96,7 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
audioSlidePlayer!!.stop()
|
||||
}
|
||||
}
|
||||
seekBar.isEnabled = false
|
||||
seekBar.progressChangeListener = object : WaveformSeekBar.ProgressChangeListener {
|
||||
override fun onProgressChanged(waveformSeekBar: WaveformSeekBar, progress: Float, fromUser: Boolean) {
|
||||
if (fromUser && audioSlidePlayer != null) {
|
||||
@ -233,7 +234,6 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
super.setEnabled(enabled)
|
||||
playButton.isEnabled = enabled
|
||||
pauseButton.isEnabled = enabled
|
||||
seekBar.isEnabled = enabled
|
||||
downloadButton.isEnabled = enabled
|
||||
}
|
||||
|
||||
@ -299,6 +299,8 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
private val hostView: View,
|
||||
private val seekBar: WaveformSeekBar): Runnable {
|
||||
|
||||
private var active = false
|
||||
|
||||
companion object {
|
||||
private const val UPDATE_PERIOD = 350L // In milliseconds.
|
||||
private val random = Random()
|
||||
@ -306,14 +308,18 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
|
||||
fun start() {
|
||||
stop()
|
||||
active = true
|
||||
hostView.postDelayed(this, UPDATE_PERIOD)
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
active = false
|
||||
hostView.removeCallbacks(this)
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
if (!active) return
|
||||
|
||||
// Generate a random samples with values up to the 50% of the maximum value.
|
||||
seekBar.sampleData = ByteArray(PrepareAttachmentAudioExtrasJob.VISUAL_RMS_FRAMES)
|
||||
{ (random.nextInt(127) - 64).toByte() }
|
||||
|
@ -131,7 +131,7 @@ public abstract class Slide {
|
||||
|
||||
public @NonNull String getContentDescription() { return ""; }
|
||||
|
||||
public Attachment asAttachment() {
|
||||
public @NonNull Attachment asAttachment() {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user