From d7174d3c740bf3eafe99d1a39bd6d50935a0c786 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Thu, 5 Aug 2021 14:13:24 +0300 Subject: [PATCH] Fix concurrent modification crash. --- .../detail/composer/VoiceMessageRecorderView.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/VoiceMessageRecorderView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/VoiceMessageRecorderView.kt index ba6e0fbae7..48195dc8f1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/VoiceMessageRecorderView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/VoiceMessageRecorderView.kt @@ -326,11 +326,11 @@ class VoiceMessageRecorderView @JvmOverloads constructor( } } - private fun renderRecordingWaveform(amplitudeList: List) { - views.voicePlaybackWaveform.apply { - post { - amplitudeList.forEach { amplitude -> - update(amplitude) + private fun renderRecordingWaveform(amplitudeList: Array) { + post { + views.voicePlaybackWaveform.apply { + amplitudeList.iterator().forEach { + update(it) } } } @@ -404,7 +404,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor( scaleX = 1f scaleY = 1f translationX = 0f - translationY = 0f + translationY = 0f } isCancelled?.let { callback?.onVoiceRecordingEnded(it) @@ -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)