mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 17:58:25 +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()
|
audioSlidePlayer!!.stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
seekBar.isEnabled = false
|
||||||
seekBar.progressChangeListener = object : WaveformSeekBar.ProgressChangeListener {
|
seekBar.progressChangeListener = object : WaveformSeekBar.ProgressChangeListener {
|
||||||
override fun onProgressChanged(waveformSeekBar: WaveformSeekBar, progress: Float, fromUser: Boolean) {
|
override fun onProgressChanged(waveformSeekBar: WaveformSeekBar, progress: Float, fromUser: Boolean) {
|
||||||
if (fromUser && audioSlidePlayer != null) {
|
if (fromUser && audioSlidePlayer != null) {
|
||||||
@ -233,7 +234,6 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
|||||||
super.setEnabled(enabled)
|
super.setEnabled(enabled)
|
||||||
playButton.isEnabled = enabled
|
playButton.isEnabled = enabled
|
||||||
pauseButton.isEnabled = enabled
|
pauseButton.isEnabled = enabled
|
||||||
seekBar.isEnabled = enabled
|
|
||||||
downloadButton.isEnabled = enabled
|
downloadButton.isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,6 +299,8 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
|||||||
private val hostView: View,
|
private val hostView: View,
|
||||||
private val seekBar: WaveformSeekBar): Runnable {
|
private val seekBar: WaveformSeekBar): Runnable {
|
||||||
|
|
||||||
|
private var active = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val UPDATE_PERIOD = 350L // In milliseconds.
|
private const val UPDATE_PERIOD = 350L // In milliseconds.
|
||||||
private val random = Random()
|
private val random = Random()
|
||||||
@ -306,14 +308,18 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
|||||||
|
|
||||||
fun start() {
|
fun start() {
|
||||||
stop()
|
stop()
|
||||||
|
active = true
|
||||||
hostView.postDelayed(this, UPDATE_PERIOD)
|
hostView.postDelayed(this, UPDATE_PERIOD)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
|
active = false
|
||||||
hostView.removeCallbacks(this)
|
hostView.removeCallbacks(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
if (!active) return
|
||||||
|
|
||||||
// Generate a random samples with values up to the 50% of the maximum value.
|
// Generate a random samples with values up to the 50% of the maximum value.
|
||||||
seekBar.sampleData = ByteArray(PrepareAttachmentAudioExtrasJob.VISUAL_RMS_FRAMES)
|
seekBar.sampleData = ByteArray(PrepareAttachmentAudioExtrasJob.VISUAL_RMS_FRAMES)
|
||||||
{ (random.nextInt(127) - 64).toByte() }
|
{ (random.nextInt(127) - 64).toByte() }
|
||||||
|
@ -131,7 +131,7 @@ public abstract class Slide {
|
|||||||
|
|
||||||
public @NonNull String getContentDescription() { return ""; }
|
public @NonNull String getContentDescription() { return ""; }
|
||||||
|
|
||||||
public Attachment asAttachment() {
|
public @NonNull Attachment asAttachment() {
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user