From 40d5dd469a94d394bd369362c788ce02958b8ebc Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 28 Jan 2020 15:19:29 +0100 Subject: [PATCH] Delay only if not empty Signed-off-by: Mario Danic --- .../talk/newarch/features/search/DebouncingTextWatcher.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/newarch/features/search/DebouncingTextWatcher.kt b/app/src/main/java/com/nextcloud/talk/newarch/features/search/DebouncingTextWatcher.kt index 57ea8ebf5..77fcac0e0 100644 --- a/app/src/main/java/com/nextcloud/talk/newarch/features/search/DebouncingTextWatcher.kt +++ b/app/src/main/java/com/nextcloud/talk/newarch/features/search/DebouncingTextWatcher.kt @@ -66,9 +66,11 @@ class DebouncingTextWatcher( searchJob?.cancel() searchJob = coroutineScope.launch { charSequence.let { - delay(debouncePeriod) + if (!charSequence.isNullOrEmpty()) { + delay(debouncePeriod) + } onDebouncingTextWatcherChange(charSequence) } } } -} \ No newline at end of file +}