mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-15 19:52:19 +00:00
Warning cleanup
This commit is contained in:
parent
27a46cac19
commit
78f935c59f
@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicLong
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun onDestroy() {
|
open fun onDestroy() {
|
||||||
handler.postDelayed(cleanup, cleanupDelayMs)
|
handler.postDelayed(cleanup, CLEANUP_DELAY_MS)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onCleanup() {
|
open fun onCleanup() {
|
||||||
@ -45,7 +45,7 @@ import java.util.concurrent.atomic.AtomicLong
|
|||||||
.subscribeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
}
|
||||||
|
|
||||||
val context: Context = Application.instance!!
|
val context: Context = Application.instance
|
||||||
|
|
||||||
internal val cleanup = Runnable {
|
internal val cleanup = Runnable {
|
||||||
idToInstance.remove(id)
|
idToInstance.remove(id)
|
||||||
@ -67,7 +67,7 @@ import java.util.concurrent.atomic.AtomicLong
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val cleanupDelayMs = 3000L
|
private const val CLEANUP_DELAY_MS = 3000L
|
||||||
private val nextId = AtomicLong(System.currentTimeMillis() + 0)
|
private val nextId = AtomicLong(System.currentTimeMillis() + 0)
|
||||||
private val handler by lazy { Handler(Looper.getMainLooper()) }
|
private val handler by lazy { Handler(Looper.getMainLooper()) }
|
||||||
private val idToInstance = mutableMapOf<Long, ViewModel<*>>()
|
private val idToInstance = mutableMapOf<Long, ViewModel<*>>()
|
||||||
|
Loading…
Reference in New Issue
Block a user