Skip to content

Commit

Permalink
Display episode date if available
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Aug 16, 2021
1 parent 3846589 commit c2b9455
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions common-ui-view/src/main/java/app/tivi/util/TiviTextCreator.kt
Expand Up @@ -122,13 +122,15 @@ class TiviTextCreator @Inject constructor(
return text
}

fun episodeNumberText(episode: Episode): CharSequence? {
fun episodeNumberText(episode: Episode): CharSequence {
val text = StringBuilder()
text.append(context.getString(R.string.episode_number, episode.number))
if (episode.firstAired?.isAfter(OffsetDateTime.now()) == true) {

episode.firstAired?.also {
text.append(" \u2022 ")
text.append(tiviDateFormatter.formatShortRelativeTime(episode.firstAired!!))
text.append(tiviDateFormatter.formatShortRelativeTime(it))
}

return text
}

Expand Down

0 comments on commit c2b9455

Please sign in to comment.