Java 类io.reactivex.CompletableSource 实例源码

项目:pandroid    文件:MainObserverTransformer.java   
@Override
public CompletableSource apply(Completable upstream) {
    Completable tObservable = upstream
            .observeOn(AndroidSchedulers.mainThread());
    if (provider == null) {
        return tObservable;
    }
    return tObservable.compose(RxLifecycleDelegate.<T>bindLifecycle(provider));
}
项目:pandroid    文件:RxLifecycleTransformer.java   
/**
 * TakeUntil n'existe pas sur un completable. Amb permet de la premère émission
 *
 * @param upstream
 * @return
 */
@Override
public CompletableSource apply(Completable upstream) {
    return Completable.ambArray(upstream, mObservable.flatMapCompletable(new Function<Object, CompletableSource>() {
        @Override
        public CompletableSource apply(@NonNull Object o) throws Exception {
            return Completable.error(new CancellationException());
        }
    }));
}
项目:SimpleCropView    文件:RxFragment.java   
private Disposable loadImage(final Uri uri) {
  mSourceUri = uri;
  return new RxPermissions(getActivity()).request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
      .filter(new Predicate<Boolean>() {
        @Override public boolean test(@io.reactivex.annotations.NonNull Boolean granted)
            throws Exception {
          return granted;
        }
      })
      .flatMapCompletable(new Function<Boolean, CompletableSource>() {
        @Override
        public CompletableSource apply(@io.reactivex.annotations.NonNull Boolean aBoolean)
            throws Exception {
          return mCropView.load(uri)
              .useThumbnail(true)
              .initialFrameRect(mFrameRect)
              .executeAsCompletable();
        }
      })
      .subscribeOn(Schedulers.newThread())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(new Action() {
        @Override public void run() throws Exception {
        }
      }, new Consumer<Throwable>() {
        @Override public void accept(@NonNull Throwable throwable) throws Exception {
        }
      });
}
项目:recyclerview-binder    文件:LifecycleTransformer.java   
@Override
public CompletableSource apply(Completable upstream) {
    return Completable.ambArray(upstream, observable.flatMapCompletable(new Function<Object, Completable>() {
        @Override
        public Completable apply(Object ignore) throws Exception {
            return Completable.error(new CancellationException());
        }
    }));
}
项目:Rx2Animations    文件:RxAnimations.java   
public static Completable animateTogether(final CompletableSource... completables) {
    return Completable.mergeArray(completables);
}
项目:DisposableAttach    文件:AttachDisposableCompletable.java   
/**
 * @param source              the consumable CompletableSource
 * @param compositeDisposable the composite disposable
 */
public AttachDisposableCompletable(CompletableSource source, CompositeDisposable compositeDisposable) {
    this.source = source;
    this.compositeDisposable = compositeDisposable;
}
项目:DisposableAttach    文件:AttachDisposableCompletable.java   
@Override
public final CompletableSource source() {
    return source;
}
项目:RxLifeCycle    文件:LifecycleTransformer.java   
@Override
public CompletableSource apply(Completable upstream) {
    return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
}
项目:RxConditions    文件:CompletableIfThen.java   
CompletableIfThen(BooleanSupplier condition, CompletableSource then,
                  CompletableSource orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxDbflow    文件:NotifyOfUpdate.java   
@Override
public CompletableSource source() {
    return mSource;
}
项目:RxDelay    文件:DelayCompletableTransformer.java   
@Override
public CompletableSource apply(Completable upstream) {
    return upstream.toObservable()
            .compose(new DelayReplayObservableTransformer<>(pauseLifecycle))
            .ignoreElements();
}
项目:AutoDispose    文件:CompletableScoper.java   
AutoDisposeCompletable(CompletableSource source, Maybe<?> scope) {
  this.source = source;
  this.scope = scope;
}
项目:ObservableCache    文件:CacheableCompletable.java   
@Override
public CompletableSource apply(Completable upstream) {
    return observableCache.cacheCompletable(key, upstream);
}
项目:Roach    文件:Deck.java   
@Exclude
public Completable evaluateDeck(final CardsInteractor cardsInteractor) {
    return Completable.defer(new Callable<CompletableSource>() {
        @Override
        public CompletableSource call() throws Exception {
            return new Completable() {
                @Override
                protected void subscribeActual(final CompletableObserver emitter) {
                    if (cards == null) {
                        cards = new HashMap<String, CardDetails>();
                    }

                    cardsInteractor.getCard(leaderId)
                            .subscribeOn(Schedulers.io())
                            .observeOn(Schedulers.io())
                            .subscribe(
                            new BaseSingleObserver<CardDetails>() {
                                @Override
                                public void onSuccess(CardDetails value) {
                                    leader = value;
                                    leader.setPatch(patch);
                                    if (cards.keySet().size() == cardCount.keySet().size()) {
                                        emitter.onComplete();
                                    }
                                }
                            });

                    if (cardCount.keySet().size() == 0) {
                        return;
                    }

                    ArrayList<String> cardIds = new ArrayList<>();
                    for (String cardId : cardCount.keySet()) {
                        cardIds.add(cardId);
                    }

                    cardsInteractor.getCards(null, cardIds)
                            .subscribeOn(Schedulers.io())
                            .observeOn(Schedulers.io())
                            .subscribe(
                            new BaseSingleObserver<CardListResult>() {
                                @Override
                                public void onSuccess(CardListResult result) {
                                    if (result instanceof CardListResult.Success) {
                                        for (CardDetails card : ((CardListResult.Success) result).getCards()) {
                                            cards.put(card.getIngameId(), card);
                                        }
                                        if (leader != null) {
                                            emitter.onComplete();
                                        }
                                    }
                                }
                            });
                }
            };
        }
    });
}
项目:arctor    文件:WaitViewLatestTransformer.java   
@Override
public CompletableSource apply(Completable upstream) {
    return ((Observable<T>) apply(upstream.<T>toObservable())).ignoreElements();
}
项目:arctor    文件:WaitViewReplayTransformer.java   
@Override
public CompletableSource apply(Completable upstream) {
    return ((Observable<T>) apply(upstream.<T>toObservable())).ignoreElements();
}
项目:pandroid    文件:RxLifecycleTransformerEmpty.java   
/**
 * TakeUntil n'existe pas sur un completable. Amb permet de la premère émission
 * @param upstream
 * @return
 */
@Override
public CompletableSource apply(Completable upstream) {
    return upstream;
}