From 7d99e250555a8696954fdb38583e9e4e61e5a3f0 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Tue, 9 Jul 2024 21:42:00 +0530 Subject: [PATCH] Animate playlist description expand/collapse --- .../newpipe/compose/playlist/PlaylistHeader.kt | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt b/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt index 455690d394f..cdb87351c64 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt +++ b/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt @@ -1,6 +1,7 @@ package org.schabi.newpipe.compose.playlist import android.content.res.Configuration +import androidx.compose.animation.animateContentSize import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image import androidx.compose.foundation.border @@ -52,19 +53,10 @@ import java.util.concurrent.TimeUnit fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) { val context = LocalContext.current - Column( - modifier = Modifier.padding(12.dp), - verticalArrangement = Arrangement.spacedBy(4.dp) - ) { - Text( - text = playlistInfo.name, - style = MaterialTheme.typography.titleMedium - ) + Column(modifier = Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { + Text(text = playlistInfo.name, style = MaterialTheme.typography.titleMedium) - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { + Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp), @@ -124,6 +116,7 @@ fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) { val parsedDescription = rememberParsedDescription(description) Text( + modifier = Modifier.animateContentSize(), text = parsedDescription, maxLines = if (isExpanded) Int.MAX_VALUE else 5, style = MaterialTheme.typography.bodyMedium,