mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-27 10:03:06 +01:00
Simpler code
This commit is contained in:
parent
667b371653
commit
6639f89a68
@ -23,12 +23,9 @@ internal class Debouncer(private val handler: Handler) {
|
||||
private val runnables = HashMap<String, Runnable>()
|
||||
|
||||
fun debounce(identifier: String, r: Runnable, millis: Long): Boolean {
|
||||
if (runnables.containsKey(identifier)) {
|
||||
// debounce
|
||||
runnables[identifier]?.let {
|
||||
handler.removeCallbacks(it)
|
||||
}
|
||||
}
|
||||
runnables[identifier]?.let { runnable -> handler.removeCallbacks(runnable) }
|
||||
|
||||
insertRunnable(identifier, r, millis)
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user