mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-01 22:58:57 +01:00
Use kotlin.time extensions in some more places
This commit is contained in:
@@ -25,6 +25,7 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
/**
|
||||
* Cache where we dump the downloads directory from the filesystem. This class is needed because
|
||||
@@ -243,13 +244,13 @@ class DownloadCache(
|
||||
var sources = getSources()
|
||||
|
||||
// Try to wait until extensions and sources have loaded
|
||||
withTimeout(30000L) {
|
||||
withTimeout(30.seconds) {
|
||||
while (!extensionManager.isInitialized) {
|
||||
delay(2000L)
|
||||
delay(2.seconds)
|
||||
}
|
||||
|
||||
while (sources.isEmpty()) {
|
||||
delay(2000L)
|
||||
delay(2.seconds)
|
||||
sources = getSources()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ import logcat.LogPriority
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class MainActivity : BaseActivity() {
|
||||
|
||||
@@ -550,7 +551,7 @@ class MainActivity : BaseActivity() {
|
||||
private suspend fun resetExitConfirmation() {
|
||||
isConfirmingExit = true
|
||||
val toast = toast(R.string.confirm_exit, Toast.LENGTH_LONG)
|
||||
delay(2000)
|
||||
delay(2.seconds)
|
||||
toast.cancel()
|
||||
isConfirmingExit = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user