Skip to content

Commit

Permalink
Merge pull request #3797 from vector-im/feature/ons/fix_voice_message…
Browse files Browse the repository at this point in the history
…_crash

Voice Message - Fix amplitude update java.util.ConcurrentModificationException
  • Loading branch information
onurays authored Aug 5, 2021
2 parents 2e4750a + d7174d3 commit 78653eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/3796.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Voice Message - Amplitude update java.util.ConcurrentModificationException
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
}
}

private fun renderRecordingWaveform(amplitudeList: List<Int>) {
views.voicePlaybackWaveform.apply {
post {
amplitudeList.forEach { amplitude ->
update(amplitude)
private fun renderRecordingWaveform(amplitudeList: Array<Int>) {
post {
views.voicePlaybackWaveform.apply {
amplitudeList.iterator().forEach {
update(it)
}
}
}
Expand Down Expand Up @@ -404,7 +404,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
scaleX = 1f
scaleY = 1f
translationX = 0f
translationY = 0f
translationY = 0f
}
isCancelled?.let {
callback?.onVoiceRecordingEnded(it)
Expand Down Expand Up @@ -503,7 +503,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
override fun onUpdate(state: VoiceMessagePlaybackTracker.Listener.State) {
when (state) {
is VoiceMessagePlaybackTracker.Listener.State.Recording -> {
renderRecordingWaveform(state.amplitudeList)
renderRecordingWaveform(state.amplitudeList.toTypedArray())
}
is VoiceMessagePlaybackTracker.Listener.State.Playing -> {
views.voicePlaybackControlButton.setImageResource(R.drawable.ic_play_pause_pause)
Expand Down

0 comments on commit 78653eb

Please sign in to comment.