mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-06-05 21:59:19 +02:00
Make timer staring synchronized
This commit is contained in:
@ -26,7 +26,7 @@ object SleepTimer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context(Context)
|
context(Context)
|
||||||
fun startTimer() {
|
fun startTimer() = synchronized(this@SleepTimer) {
|
||||||
val millisInFuture = config.sleepInTS - System.currentTimeMillis() + 1000L
|
val millisInFuture = config.sleepInTS - System.currentTimeMillis() + 1000L
|
||||||
sleepTimer?.cancel()
|
sleepTimer?.cancel()
|
||||||
sleepTimer = object : CountDownTimer(millisInFuture, 1000) {
|
sleepTimer = object : CountDownTimer(millisInFuture, 1000) {
|
||||||
|
Reference in New Issue
Block a user