14 lines
503 B
Kotlin
14 lines
503 B
Kotlin
package solutions.tretter.mindmachine.session
|
|
|
|
import solutions.tretter.mindmachine.domain.RuntimeState
|
|
|
|
fun shouldShowActiveControlsByDefault(runtimeState: RuntimeState): Boolean {
|
|
return runtimeState != RuntimeState.RUNNING && runtimeState != RuntimeState.COUNTDOWN
|
|
}
|
|
|
|
fun sessionProgressFraction(durationSec: Int, remainingSec: Int): Float {
|
|
val total = durationSec.coerceAtLeast(1)
|
|
val elapsed = (total - remainingSec).coerceIn(0, total)
|
|
return elapsed.toFloat() / total.toFloat()
|
|
}
|