Fix concurrent modification crash.

This commit is contained in:
Onuray Sahin 2021-08-05 14:13:24 +03:00
parent c57ae131dc
commit d7174d3c74
1 changed files with 7 additions and 7 deletions

View File

@ -326,11 +326,11 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
}
}
private fun renderRecordingWaveform(amplitudeList: List<Int>) {
views.voicePlaybackWaveform.apply {
private fun renderRecordingWaveform(amplitudeList: Array<Int>) {
post {
amplitudeList.forEach { amplitude ->
update(amplitude)
views.voicePlaybackWaveform.apply {
amplitudeList.iterator().forEach {
update(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)