Use `buildList` in `secondsToString` in `MainActivity`
This commit is contained in:
parent
1600a072ef
commit
7533ad1fa2
|
@ -369,17 +369,17 @@ class MainActivity : ComponentActivity() {
|
|||
val finalHours = seconds / 3600
|
||||
val finalMinutes = (seconds / 60) % 60
|
||||
val finalSeconds = seconds % 60
|
||||
val parts = mutableListOf<String>()
|
||||
return buildList {
|
||||
if (finalHours != 0) {
|
||||
parts.add(resources.getQuantityString(com.simplemobiletools.commons.R.plurals.hours, finalHours, finalHours))
|
||||
add(resources.getQuantityString(com.simplemobiletools.commons.R.plurals.hours, finalHours, finalHours))
|
||||
}
|
||||
if (finalMinutes != 0) {
|
||||
parts.add(resources.getQuantityString(com.simplemobiletools.commons.R.plurals.minutes, finalMinutes, finalMinutes))
|
||||
add(resources.getQuantityString(com.simplemobiletools.commons.R.plurals.minutes, finalMinutes, finalMinutes))
|
||||
}
|
||||
if (finalSeconds != 0) {
|
||||
parts.add(resources.getQuantityString(com.simplemobiletools.commons.R.plurals.seconds, finalSeconds, finalSeconds))
|
||||
add(resources.getQuantityString(com.simplemobiletools.commons.R.plurals.seconds, finalSeconds, finalSeconds))
|
||||
}
|
||||
return parts.joinToString(separator = " ")
|
||||
}.joinToString(separator = " ")
|
||||
}
|
||||
|
||||
private fun pickedSleepTimer(seconds: Int) {
|
||||
|
|
Loading…
Reference in New Issue