@@ -57,23 +57,21 @@ fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
57
57
Text (text = playlistInfo.name, style = MaterialTheme .typography.titleMedium)
58
58
59
59
Row (modifier = Modifier .fillMaxWidth(), horizontalArrangement = Arrangement .SpaceBetween ) {
60
+ val clickable = playlistInfo.uploaderName != null && playlistInfo.uploaderUrl != null
61
+
60
62
Row (
61
63
verticalAlignment = Alignment .CenterVertically ,
62
64
horizontalArrangement = Arrangement .spacedBy(4 .dp),
63
- modifier = Modifier .let {
64
- if (playlistInfo.uploaderName != null && playlistInfo.uploaderUrl != null ) {
65
- it.clickable {
66
- try {
67
- NavigationHelper .openChannelFragment(
68
- (context as FragmentActivity ).supportFragmentManager,
69
- playlistInfo.serviceId, playlistInfo.uploaderUrl,
70
- playlistInfo.uploaderName
71
- )
72
- } catch (e: Exception ) {
73
- ErrorUtil .showUiErrorSnackbar(context, " Opening channel fragment" , e)
74
- }
75
- }
76
- } else it
65
+ modifier = Modifier .clickable(clickable) {
66
+ try {
67
+ NavigationHelper .openChannelFragment(
68
+ (context as FragmentActivity ).supportFragmentManager,
69
+ playlistInfo.serviceId, playlistInfo.uploaderUrl,
70
+ playlistInfo.uploaderName
71
+ )
72
+ } catch (e: Exception ) {
73
+ ErrorUtil .showUiErrorSnackbar(context, " Opening channel fragment" , e)
74
+ }
77
75
}
78
76
) {
79
77
val imageModifier = Modifier
@@ -113,17 +111,22 @@ fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
113
111
val description = playlistInfo.description ? : Description .EMPTY_DESCRIPTION
114
112
if (description != Description .EMPTY_DESCRIPTION ) {
115
113
var isExpanded by rememberSaveable { mutableStateOf(false ) }
116
- val parsedDescription = rememberParsedDescription(description)
114
+ var isExpandable by rememberSaveable { mutableStateOf( false ) }
117
115
118
116
Text (
119
117
modifier = Modifier .animateContentSize(),
120
- text = parsedDescription ,
118
+ text = rememberParsedDescription(description) ,
121
119
maxLines = if (isExpanded) Int .MAX_VALUE else 5 ,
122
120
style = MaterialTheme .typography.bodyMedium,
123
121
overflow = TextOverflow .Ellipsis ,
122
+ onTextLayout = {
123
+ if (it.hasVisualOverflow) {
124
+ isExpandable = true
125
+ }
126
+ }
124
127
)
125
128
126
- if (parsedDescription.lineSequence().take( 6 ).count() > 5 ) {
129
+ if (isExpandable ) {
127
130
TextButton (
128
131
onClick = { isExpanded = ! isExpanded },
129
132
modifier = Modifier .align(Alignment .End )
0 commit comments