1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-09 08:50:34 +00:00

Animate playlist description expand/collapse

This commit is contained in:
Isira Seneviratne 2024-07-09 21:42:00 +05:30
parent bbdff4b093
commit 7501f2f9ee

View File

@ -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,