Merge pull request #3797 from vector-im/feature/ons/fix_voice_message_crash
Voice Message - Fix amplitude update java.util.ConcurrentModificationException
This commit is contained in:
commit
78653eb1d9
1
changelog.d/3796.bugfix
Normal file
1
changelog.d/3796.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Voice Message - Amplitude update java.util.ConcurrentModificationException
|
@ -326,11 +326,11 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderRecordingWaveform(amplitudeList: List<Int>) {
|
private fun renderRecordingWaveform(amplitudeList: Array<Int>) {
|
||||||
views.voicePlaybackWaveform.apply {
|
post {
|
||||||
post {
|
views.voicePlaybackWaveform.apply {
|
||||||
amplitudeList.forEach { amplitude ->
|
amplitudeList.iterator().forEach {
|
||||||
update(amplitude)
|
update(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
scaleX = 1f
|
scaleX = 1f
|
||||||
scaleY = 1f
|
scaleY = 1f
|
||||||
translationX = 0f
|
translationX = 0f
|
||||||
translationY = 0f
|
translationY = 0f
|
||||||
}
|
}
|
||||||
isCancelled?.let {
|
isCancelled?.let {
|
||||||
callback?.onVoiceRecordingEnded(it)
|
callback?.onVoiceRecordingEnded(it)
|
||||||
@ -503,7 +503,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
override fun onUpdate(state: VoiceMessagePlaybackTracker.Listener.State) {
|
override fun onUpdate(state: VoiceMessagePlaybackTracker.Listener.State) {
|
||||||
when (state) {
|
when (state) {
|
||||||
is VoiceMessagePlaybackTracker.Listener.State.Recording -> {
|
is VoiceMessagePlaybackTracker.Listener.State.Recording -> {
|
||||||
renderRecordingWaveform(state.amplitudeList)
|
renderRecordingWaveform(state.amplitudeList.toTypedArray())
|
||||||
}
|
}
|
||||||
is VoiceMessagePlaybackTracker.Listener.State.Playing -> {
|
is VoiceMessagePlaybackTracker.Listener.State.Playing -> {
|
||||||
views.voicePlaybackControlButton.setImageResource(R.drawable.ic_play_pause_pause)
|
views.voicePlaybackControlButton.setImageResource(R.drawable.ic_play_pause_pause)
|
||||||
|
Loading…
Reference in New Issue
Block a user