io.reactivex.CompletableTransformer Java Examples

The following examples show how to use io.reactivex.CompletableTransformer. 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: NotificationAndIndicationManager.java    From RxAndroidBle with Apache License 2.0 6 votes vote down vote up
@NonNull
static CompletableTransformer teardownModeTransformer(final DescriptorWriter descriptorWriter,
                                                      final BluetoothGattCharacteristic characteristic,
                                                      final byte[] value,
                                                      final NotificationSetupMode mode) {
    return new CompletableTransformer() {
        @Override
        public Completable apply(Completable completable) {
            if (mode == NotificationSetupMode.COMPAT) {
                return completable;
            } else {
                return completable.andThen(writeClientCharacteristicConfig(characteristic, descriptorWriter, value));
            }
        }
    };
}
 
Example #2
Source File: RxUtil.java    From AcgClub with MIT License 5 votes vote down vote up
/**
 * Completable线程切换简化
 */
public static CompletableTransformer completableSchedulerHelper() {
  return new CompletableTransformer() {
    @Override
    public Completable apply(Completable observable) {
      return observable.subscribeOn(Schedulers.io())
          .observeOn(AndroidSchedulers.mainThread());
    }
  };
}
 
Example #3
Source File: CompletableUseCase.java    From EasyMVP with Apache License 2.0 5 votes vote down vote up
public CompletableUseCase(final UseCaseExecutor useCaseExecutor,
                          final PostExecutionThread postExecutionThread) {
    super(useCaseExecutor, postExecutionThread);
    schedulersTransformer = new CompletableTransformer() {
        @Override
        public Completable apply(Completable completable) {
            return completable.subscribeOn(useCaseExecutor.getScheduler())
                    .observeOn(postExecutionThread.getScheduler());
        }
    };
}
 
Example #4
Source File: CompletableUseCase.java    From EasyMVP with Apache License 2.0 4 votes vote down vote up
private CompletableTransformer getSchedulersTransformer() {
    return schedulersTransformer;
}
 
Example #5
Source File: MainActivity.java    From StompProtocolAndroid with MIT License 4 votes vote down vote up
protected CompletableTransformer applySchedulers() {
    return upstream -> upstream
            .unsubscribeOn(Schedulers.newThread())
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread());
}