Skip to content

Commit

Permalink
Improved PlaylistHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Jul 28, 2024
1 parent 79928e3 commit 60f9459
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,21 @@ fun PlaylistHeader(playlistInfo: PlaylistInfo, totalDuration: Long) {
Text(text = playlistInfo.name, style = MaterialTheme.typography.titleMedium)

Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
val clickable = playlistInfo.uploaderName != null && playlistInfo.uploaderUrl != null

Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = Modifier.let {
if (playlistInfo.uploaderName != null && playlistInfo.uploaderUrl != null) {
it.clickable {
try {
NavigationHelper.openChannelFragment(
(context as FragmentActivity).supportFragmentManager,
playlistInfo.serviceId, playlistInfo.uploaderUrl,
playlistInfo.uploaderName
)
} catch (e: Exception) {
ErrorUtil.showUiErrorSnackbar(context, "Opening channel fragment", e)
}
}
} else it
modifier = Modifier.clickable(clickable) {
try {
NavigationHelper.openChannelFragment(
(context as FragmentActivity).supportFragmentManager,
playlistInfo.serviceId, playlistInfo.uploaderUrl,
playlistInfo.uploaderName
)
} catch (e: Exception) {
ErrorUtil.showUiErrorSnackbar(context, "Opening channel fragment", e)
}
}
) {
val imageModifier = Modifier
Expand Down

0 comments on commit 60f9459

Please sign in to comment.