Java Code Examples for io.reactivex.schedulers.Schedulers#trampoline()

The following examples show how to use io.reactivex.schedulers.Schedulers#trampoline() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsPresenterTest.java    From adamant-android with GNU General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() {
    Context systemContext = RuntimeEnvironment.systemContext;

    TestAppComponent component = DaggerTestAppComponent
            .builder()
            .context(systemContext)
            .build();

    component.inject(this);

    view = mock(SettingsView.class);
    disposable = new CompositeDisposable();

    presenter = new SettingsPresenter(
            router,
            accountInteractor,
            logoutInteractor,
            api,
            securityInteractor,
            switchPushNotificationServiceInteractor,
            Schedulers.trampoline()
    );
}
 
Example 2
Source File: RxBus.java    From YiZhi with Apache License 2.0 6 votes vote down vote up
/**
 * 用于处理订阅事件在那个线程中执行
 *
 * @param observable       d
 * @param subscriberMethod d
 * @return Observable
 */
private Flowable postToObservable(Flowable observable, SubscriberMethod subscriberMethod) {
    Scheduler scheduler;
    switch (subscriberMethod.threadMode) {
        case MAIN:
            scheduler = AndroidSchedulers.mainThread();
            break;

        case NEW_THREAD:
            scheduler = Schedulers.newThread();
            break;

        case CURRENT_THREAD:
            scheduler = Schedulers.trampoline();
            break;
        default:
            throw new IllegalStateException("Unknown thread mode: " + subscriberMethod.threadMode);
    }
    return observable.observeOn(scheduler);
}
 
Example 3
Source File: TimelinePresenterTest.java    From twittererer with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);

    presenter = new TimelinePresenter(twitterService, Schedulers.trampoline());

    user = new User("Bob", "bob", "");
    timelineItems = new ArrayList<>();
    timelineItems.add(new TimelineItem("", "", user));

    when(twitterService.getTimelineItems()).thenReturn(Observable.just(timelineItems));
    when(twitterService.getMyDetails()).thenReturn(Observable.just(user));
}
 
Example 4
Source File: Sandbox.java    From Reactive-Android-Programming with MIT License 5 votes vote down vote up
private void demo0() {
    Schedulers.single();
    Schedulers.trampoline();
    Schedulers.newThread();
    Schedulers.computation();
    Schedulers.io();
    Schedulers.io();
}
 
Example 5
Source File: Sandbox.java    From Reactive-Android-Programming with MIT License 5 votes vote down vote up
private void demo0() {
    Schedulers.single();
    Schedulers.trampoline();
    Schedulers.newThread();
    Schedulers.computation();
    Schedulers.io();
    Schedulers.io();
}
 
Example 6
Source File: Rx.java    From klingar with Apache License 2.0 4 votes vote down vote up
public static Rx test() {
  return new Rx(Schedulers.trampoline(), Schedulers.trampoline(), Schedulers.trampoline());
}
 
Example 7
Source File: ConsoleSchedulerProvider.java    From marvel with MIT License 4 votes vote down vote up
@Override
public Scheduler backgroundThread() {
    return Schedulers.trampoline();
}
 
Example 8
Source File: ConsoleSchedulerProvider.java    From marvel with MIT License 4 votes vote down vote up
@Override
public Scheduler mainThread() {
    return Schedulers.trampoline();
}
 
Example 9
Source File: RxSchedulersOverrideRule.java    From incubator-taverna-mobile with Apache License 2.0 4 votes vote down vote up
public Scheduler getScheduler() {
    return Schedulers.trampoline();
}
 
Example 10
Source File: ImmediateScheduler.java    From RetroMusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler ui() {
    return Schedulers.trampoline();
}
 
Example 11
Source File: RxJavaUtilsTest.java    From storio with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
protected Scheduler defaultRxScheduler() {
    return Schedulers.trampoline();
}
 
Example 12
Source File: ImmediateScheduler.java    From RetroMusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler computation() {
    return Schedulers.trampoline();
}
 
Example 13
Source File: TrampolineSchedulerProvider.java    From Melophile with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler multi() {
  return Schedulers.trampoline();
}
 
Example 14
Source File: TrampolineSchedulerProvider.java    From Melophile with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler ui() {
  return Schedulers.trampoline();
}
 
Example 15
Source File: ImmediateSchedulerProvider.java    From mobius-android-sample with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler computation() {
  return Schedulers.trampoline();
}
 
Example 16
Source File: TrampolineSchedulerProvider.java    From Melophile with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler computation() {
  return Schedulers.trampoline();
}
 
Example 17
Source File: TestGeneralModule.java    From adamant-android with GNU General Public License v3.0 4 votes vote down vote up
@Named(Constants.UI_SCHEDULER)
@Singleton
@Provides
public static Scheduler provideUIObserveScheduler() {
    return Schedulers.trampoline();
}
 
Example 18
Source File: ImmediateSchedulerProvider.java    From mobius-android-sample with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler ui() {
  return Schedulers.trampoline();
}
 
Example 19
Source File: ImmediateSchedulerProvider.java    From mobius-android-sample with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public Scheduler io() {
  return Schedulers.trampoline();
}
 
Example 20
Source File: SchedulerProviderImplementation.java    From NYBus with Apache License 2.0 2 votes vote down vote up
/**
 * Provides the trampoline thread Scheduler.
 *
 * @return provides the trampoline thread Scheduler.
 */
@Override
public Scheduler provideTrampolineScheduler() {
    return Schedulers.trampoline();
}