mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-31 04:03:59 +03:00
Simpler code
This commit is contained in:
parent
667b371653
commit
6639f89a68
1 changed files with 3 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
// debounce
|
||||
runnables[identifier]?.let { runnable -> handler.removeCallbacks(runnable) }
|
||||
|
||||
insertRunnable(identifier, r, millis)
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue