Skip to content

Instantly share code, notes, and snippets.

@vvsevolodovich
Created January 21, 2019 13:50
Show Gist options
  • Save vvsevolodovich/16219bc4a15ed1f55eb755fb2bcf5c9d to your computer and use it in GitHub Desktop.
Save vvsevolodovich/16219bc4a15ed1f55eb755fb2bcf5c9d to your computer and use it in GitHub Desktop.
RxJava Search
publishSubject
.debounce(300, TimeUnit.MILLISECONDS)
.distinctUntilChanged()
.switchMap {
searchQuery -> apiClientRxImpl.searchRepositories(searchQuery)
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
repos.adapter = ReposAdapter(
it.map { it.full_name },
this@RepositoriesActivity)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment