Delay only if not empty

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-01-28 15:19:29 +01:00
parent cd35b6eb24
commit 40d5dd469a
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0

View File

@ -66,9 +66,11 @@ class DebouncingTextWatcher(
searchJob?.cancel()
searchJob = coroutineScope.launch {
charSequence.let {
delay(debouncePeriod)
if (!charSequence.isNullOrEmpty()) {
delay(debouncePeriod)
}
onDebouncingTextWatcherChange(charSequence)
}
}
}
}
}