mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Merge pull request #6222 from vector-im/feature/ons/fix_voice_message_stackoverflow
Fix StackOverflowError while recording voice message [PSF-1065]
This commit is contained in:
commit
bae830dd03
2 changed files with 4 additions and 1 deletions
1
changelog.d/6222.bugfix
Normal file
1
changelog.d/6222.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix StackOverflowError while recording voice message
|
|
@ -151,12 +151,14 @@ class AudioWaveformView @JvmOverloads constructor(
|
|||
|
||||
private fun handleNewFftList(fftList: List<FFT>) {
|
||||
val maxVisibleBarCount = getMaxVisibleBarCount()
|
||||
|
||||
fftList.forEach { fft ->
|
||||
rawFftList.add(fft)
|
||||
val barHeight = max(fft.value / MAX_FFT * (height - verticalPadding * 2), barMinHeight)
|
||||
visibleBarHeights.add(FFT(barHeight, fft.color))
|
||||
|
||||
if (visibleBarHeights.size > maxVisibleBarCount) {
|
||||
visibleBarHeights = visibleBarHeights.subList(visibleBarHeights.size - maxVisibleBarCount, visibleBarHeights.size)
|
||||
visibleBarHeights = visibleBarHeights.takeLast(maxVisibleBarCount).toMutableList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue