diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/Queryable.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/Queryable.kt index 68c785b61..3d6f43661 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/compat/Queryable.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/compat/Queryable.kt @@ -17,10 +17,7 @@ interface Queryable { override val queryHandler = Handler(Looper.getMainLooper()) override val queryRunnable = Runnable { TODO() } - override fun submitQuery() { - queryHandler.removeCallbacks(queryRunnable) - queryHandler.postDelayed(queryRunnable, queryDelay) - } + override fun submitQuery() {} } } } \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/hide/HideViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/hide/HideViewModel.kt index 9e7b43d20..6cc893626 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/hide/HideViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/hide/HideViewModel.kt @@ -84,8 +84,12 @@ class HideViewModel( // --- override fun submitQuery() { - queryHandler.removeCallbacks(queryRunnable) - queryHandler.postDelayed(queryRunnable, queryDelay) + if (!queryHandler.hasCallbacks(queryRunnable)) { + queryHandler.post(queryRunnable) + } else { + queryHandler.removeCallbacks(queryRunnable) + queryHandler.postDelayed(queryRunnable, queryDelay) + } } private fun query( diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt index 320bf8357..585ffb8bf 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt @@ -166,8 +166,12 @@ class ModuleViewModel( // --- override fun submitQuery() { - queryHandler.removeCallbacks(queryRunnable) - queryHandler.postDelayed(queryRunnable, queryDelay) + if (!queryHandler.hasCallbacks(queryRunnable)) { + queryHandler.post(queryRunnable) + } else { + queryHandler.removeCallbacks(queryRunnable) + queryHandler.postDelayed(queryRunnable, queryDelay) + } } private fun queryInternal(query: String, offset: Int): Single> {