Skip to content

Commit

Permalink
Animate playlist description expand/collapse
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Jul 12, 2024
1 parent 6926e7f commit 7d99e25
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7d99e25

Please sign in to comment.