@Test public void uiShouldNotCallActionUntilMainThreadIsPaused() throws Exception { Consumer<String> uiAction = mock(Consumer.class); Function<Observable<String>, Disposable> binderFunc = RxUi.ui(uiAction); ShadowLooper.pauseMainLooper(); binderFunc.apply(Observable.just("a", "b", "c")); verifyZeroInteractions(uiAction); }
public static <T> Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction) { return new Function<Observable<T>, Disposable>() { @Override public Disposable apply(Observable<T> observable) { return observable .observeOn(mainThread()) .subscribe(uiAction); } }; }
RxUi { public static <T> Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction) { return new Function<Observable<T>, Disposable>() { @Override public Disposable apply(Observable<T> observable) { return observable .observeOn(mainThread()) .subscribe(uiAction); } }; } }
RxUi { public static <T> Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction) { return new Function<Observable<T>, Disposable>() { @Override public Disposable apply(Observable<T> observable) { return observable .observeOn(mainThread()) .subscribe(uiAction); } }; }  }
RxUi { public static <T> Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction) { return new Function<Observable<T>, Disposable>() { @Override public Disposable apply(Observable<T> observable) { return observable .observeOn(mainThread()) .subscribe(uiAction); } }; }  static Disposable bind(Observable<T> observable, Function<Observable<T>, Disposable> uiFunc); static Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction); }
RxUi { public static <T> Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction) { return new Function<Observable<T>, Disposable>() { @Override public Disposable apply(Observable<T> observable) { return observable .observeOn(mainThread()) .subscribe(uiAction); } }; }  static Disposable bind(Observable<T> observable, Function<Observable<T>, Disposable> uiFunc); static Function<Observable<T>, Disposable> ui(final Consumer<T> uiAction);  }