Created
August 21, 2016 18:01
-
-
Save ragdroid/869be4afc868d38f1001a107aef4cc57 to your computer and use it in GitHub Desktop.
AutoSearch - debounce the search terms Droidcon 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//AutoSearch using debounce spell | |
public Observable<SearchRequest> autoSearch() { | |
return getSearchtermObservable() | |
.debounce(500, TimeUnit.MILLISECONDS) | |
.flatMap(new Func1<String, Observable<SearchRequest>>() { | |
@Override | |
public Observable<SearchRequest> call(String term) { | |
return Observable.just(new SearchRequest(term)); | |
} | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment