mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-21 20:27:06 +03:00
use formatTime function
This commit is contained in:
parent
df6a85a944
commit
4baf786d57
1 changed files with 2 additions and 22 deletions
|
@ -936,8 +936,8 @@ private fun LazyListScope.sharedEpisodeItems(
|
||||||
?.let {
|
?.let {
|
||||||
stringResource(
|
stringResource(
|
||||||
R.string.episode_progress,
|
R.string.episode_progress,
|
||||||
formatProgress(it),
|
formatTime(it),
|
||||||
formatProgress(item.episode.totalSeconds),
|
formatTime(item.episode.totalSeconds),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
scanlator = item.episode.scanlator.takeIf { !it.isNullOrBlank() },
|
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(
|
private fun onEpisodeItemClick(
|
||||||
episodeItem: EpisodeList.Item,
|
episodeItem: EpisodeList.Item,
|
||||||
isAnyEpisodeSelected: Boolean,
|
isAnyEpisodeSelected: Boolean,
|
||||||
|
|
Loading…
Reference in a new issue