Skip to content

Commit

Permalink
Top 5 shows - Replace title with time text
Browse files Browse the repository at this point in the history
  • Loading branch information
ashiagr committed Nov 20, 2023
1 parent eb219e9 commit cbb6098
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import au.com.shiftyjelly.pocketcasts.endofyear.components.StorySecondaryText
import au.com.shiftyjelly.pocketcasts.endofyear.components.disableScale
import au.com.shiftyjelly.pocketcasts.models.entity.Podcast
import au.com.shiftyjelly.pocketcasts.repositories.endofyear.stories.StoryTopFivePodcasts
import au.com.shiftyjelly.pocketcasts.settings.stats.StatsHelper
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import au.com.shiftyjelly.pocketcasts.utils.extensions.pxToDp
import au.com.shiftyjelly.pocketcasts.localization.R as LR
Expand Down Expand Up @@ -102,6 +103,7 @@ private fun PodcastList(story: StoryTopFivePodcasts) {
story.topPodcasts.forEachIndexed { index, topPodcast ->
PodcastItem(
podcast = topPodcast.toPodcast(),
totalPlayedTimeInSecs = topPodcast.totalPlayedTime,
position = index,
tintColor = story.tintColor,
subtitleColor = story.subtitleColor,
Expand All @@ -112,13 +114,16 @@ private fun PodcastList(story: StoryTopFivePodcasts) {
@Composable
fun PodcastItem(
podcast: Podcast,
totalPlayedTimeInSecs: Double,
position: Int,
tintColor: Color,
subtitleColor: Color,
modifier: Modifier = Modifier,
) {
val context = LocalContext.current
val currentLocalView = LocalView.current
val timeText =
StatsHelper.secondsToFriendlyString(totalPlayedTimeInSecs.toLong(), context.resources)
val heightInDp = currentLocalView.height.pxToDp(context)
Row(
verticalAlignment = Alignment.CenterVertically,
Expand Down Expand Up @@ -161,7 +166,7 @@ fun PodcastItem(
.padding(bottom = 3.dp)
)
TextH70(
text = podcast.author,
text = timeText,
color = subtitleColor,
maxLines = 1,
fontFamily = FontFamily(listOf(Font(UR.font.dm_sans))),
Expand All @@ -186,6 +191,7 @@ private fun PodcastItemPreview(
title = "Title",
author = "Author",
),
totalPlayedTimeInSecs = 1000.0,
position = 0,
tintColor = Color.White,
subtitleColor = Color(0xFF8F97A4),
Expand Down

0 comments on commit cbb6098

Please sign in to comment.