Skip to content

Instantly share code, notes, and snippets.

View prashant17d97's full-sized avatar
🎯
Focusing

Prashant Kumar Singh prashant17d97

🎯
Focusing
View GitHub Profile
@mr5z
mr5z / CustomTimer.kt
Last active January 30, 2023 15:24
Resumable CountdownTimer
class CustomTimer(private val millisInFuture: Long, private val countDownInterval: Long) {
private var millisUntilFinished: Long = millisInFuture
private var timer = InternalTimer(this, millisInFuture, countDownInterval)
private var isRunning = false
var onTick: ((millisUntilFinished: Long) -> Unit)? = null
var onFinish: (() -> Unit)? = null
private class InternalTimer(