Updated handling queries so first query is always instant
This commit is contained in:
parent
784a7a7f24
commit
0f1f43057e
@ -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() {}
|
||||
}
|
||||
}
|
||||
}
|
@ -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(
|
||||
|
@ -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<List<RepoItem>> {
|
||||
|
Loading…
Reference in New Issue
Block a user