Skip to content

Commit 257feb5

Browse files
committed
improvement
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
1 parent 5bdceb9 commit 257feb5

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

app/src/main/java/com/nextcloud/talk/ui/chat/VoiceMessage.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package com.nextcloud.talk.ui.chat
99

1010
import android.text.format.DateUtils
11+
import androidx.compose.animation.core.animateIntAsState
1112
import androidx.compose.foundation.layout.Column
1213
import androidx.compose.foundation.layout.Row
1314
import androidx.compose.foundation.layout.fillMaxWidth
@@ -42,6 +43,8 @@ import com.nextcloud.talk.ui.WAVEFORM_SIZE
4243
import com.nextcloud.talk.utils.AudioUtils
4344

4445
private const val SEEKBAR_MAX = 100
46+
private const val START_WAVE_FORM_HEIGHT = 10
47+
private const val END_WAVE_FORM_HEIGHT = 56
4548

4649
@OptIn(ExperimentalMaterial3Api::class)
4750
@Suppress("Detekt.LongMethod", "LongParameterList")
@@ -75,6 +78,11 @@ fun VoiceMessage(
7578
}
7679
}
7780

81+
val animValue by animateIntAsState(
82+
if (waveformData.average() > 0) END_WAVE_FORM_HEIGHT else START_WAVE_FORM_HEIGHT,
83+
label = "size"
84+
)
85+
7886
Column {
7987
Row(
8088
verticalAlignment = Alignment.CenterVertically,
@@ -105,7 +113,7 @@ fun VoiceMessage(
105113
onSeek(message.id, progressI)
106114
},
107115
modifier = Modifier
108-
.height(56.dp)
116+
.height(animValue.dp)
109117
.fillMaxWidth()
110118
.padding(8.dp), // or weight(1f),
111119
waveformData

0 commit comments

Comments
 (0)