use formatTime function

This commit is contained in:
LuftVerbot 2023-11-26 13:43:13 +01:00
parent df6a85a944
commit 4baf786d57

View file

@ -936,8 +936,8 @@ private fun LazyListScope.sharedEpisodeItems(
?.let {
stringResource(
R.string.episode_progress,
formatProgress(it),
formatProgress(item.episode.totalSeconds),
formatTime(it),
formatTime(item.episode.totalSeconds),
)
},
scanlator = item.episode.scanlator.takeIf { !it.isNullOrBlank() },
@ -975,26 +975,6 @@ private fun LazyListScope.sharedEpisodeItems(
}
}
private fun formatProgress(milliseconds: Long): String {
return if (milliseconds > 3600000L) {
String.format(
"%d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(milliseconds),
TimeUnit.MILLISECONDS.toMinutes(milliseconds) -
TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(milliseconds)),
TimeUnit.MILLISECONDS.toSeconds(milliseconds) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(milliseconds)),
)
} else {
String.format(
"%d:%02d",
TimeUnit.MILLISECONDS.toMinutes(milliseconds),
TimeUnit.MILLISECONDS.toSeconds(milliseconds) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(milliseconds)),
)
}
}
private fun onEpisodeItemClick(
episodeItem: EpisodeList.Item,
isAnyEpisodeSelected: Boolean,