Skip to content

Commit 2aeea4b

Browse files
Animate playlist description expand/collapse
1 parent dc7086d commit 2aeea4b

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.schabi.newpipe.compose.playlist
22

33
import android.content.res.Configuration
4+
import androidx.compose.animation.animateContentSize
45
import androidx.compose.foundation.BorderStroke
56
import androidx.compose.foundation.Image
67
import androidx.compose.foundation.border
@@ -52,19 +53,10 @@ import java.util.concurrent.TimeUnit
5253
fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
5354
val context = LocalContext.current
5455

55-
Column(
56-
modifier = Modifier.padding(12.dp),
57-
verticalArrangement = Arrangement.spacedBy(4.dp)
58-
) {
59-
Text(
60-
text = playlistInfo.name,
61-
style = MaterialTheme.typography.titleMedium
62-
)
56+
Column(modifier = Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
57+
Text(text = playlistInfo.name, style = MaterialTheme.typography.titleMedium)
6358

64-
Row(
65-
modifier = Modifier.fillMaxWidth(),
66-
horizontalArrangement = Arrangement.SpaceBetween
67-
) {
59+
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
6860
Row(
6961
verticalAlignment = Alignment.CenterVertically,
7062
horizontalArrangement = Arrangement.spacedBy(4.dp),
@@ -124,6 +116,7 @@ fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
124116
val parsedDescription = rememberParsedDescription(description)
125117

126118
Text(
119+
modifier = Modifier.animateContentSize(),
127120
text = parsedDescription,
128121
maxLines = if (isExpanded) Int.MAX_VALUE else 5,
129122
style = MaterialTheme.typography.bodyMedium,

0 commit comments

Comments
 (0)