mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-09 17:00:32 +00:00
Animate playlist description expand/collapse
This commit is contained in:
parent
bbdff4b093
commit
7501f2f9ee
@ -1,6 +1,7 @@
|
|||||||
package org.schabi.newpipe.compose.playlist
|
package org.schabi.newpipe.compose.playlist
|
||||||
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.foundation.BorderStroke
|
import androidx.compose.foundation.BorderStroke
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
@ -52,19 +53,10 @@ import java.util.concurrent.TimeUnit
|
|||||||
fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
|
fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
Column(
|
Column(modifier = Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||||
modifier = Modifier.padding(12.dp),
|
Text(text = playlistInfo.name, style = MaterialTheme.typography.titleMedium)
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = playlistInfo.name,
|
|
||||||
style = MaterialTheme.typography.titleMedium
|
|
||||||
)
|
|
||||||
|
|
||||||
Row(
|
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
@ -124,6 +116,7 @@ fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
|
|||||||
var isExpandable by rememberSaveable { mutableStateOf(false) }
|
var isExpandable by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
||||||
DescriptionText(
|
DescriptionText(
|
||||||
|
modifier = Modifier.animateContentSize(),
|
||||||
description = description,
|
description = description,
|
||||||
maxLines = if (isExpanded) Int.MAX_VALUE else 5,
|
maxLines = if (isExpanded) Int.MAX_VALUE else 5,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
Loading…
Reference in New Issue
Block a user