From 7501f2f9ee99baf8885087ffaf93371ead6a1e27 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 fe7367c53..1d61ef707 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) { var isExpandable by rememberSaveable { mutableStateOf(false) } DescriptionText( + modifier = Modifier.animateContentSize(), description = description, maxLines = if (isExpanded) Int.MAX_VALUE else 5, style = MaterialTheme.typography.bodyMedium,