Created
May 15, 2015 08:19
-
-
Save plastiv/e7950be3455215c49060 to your computer and use it in GitHub Desktop.
RxLogObserver
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
public class LogObserver<T> implements Observer<T> { | |
private final String tag; | |
public LogObserver(String tag) { | |
this.tag = tag; | |
} | |
@Override public void onCompleted() { | |
System.out.println(tag + " onCompleted"); | |
} | |
@Override public void onError(Throwable e) { | |
System.out.println(tag + " onError: " + e.getMessage()); | |
e.printStackTrace(); | |
} | |
@Override public void onNext(T s) { | |
System.out.println(tag + s); | |
} | |
} |
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
return searchQuery.asObservable() | |
.doOnEach(new LogObserver<String>("search")) | |
.debounce(500, TimeUnit.MILLISECONDS) | |
.doOnEach(new LogObserver<String>("debounce")) | |
.switchMap(...) | |
.doOnEach(new LogObserver<List<Address>>("switchMap")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment