本文整理汇总了Java中io.reactivex.CompletableSource类的典型用法代码示例。如果您正苦于以下问题:Java CompletableSource类的具体用法?Java CompletableSource怎么用?Java CompletableSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompletableSource类属于io.reactivex包,在下文中一共展示了CompletableSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
Completable tObservable = upstream
.observeOn(AndroidSchedulers.mainThread());
if (provider == null) {
return tObservable;
}
return tObservable.compose(RxLifecycleDelegate.<T>bindLifecycle(provider));
}
示例2: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
/**
* 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());
}
}));
}
示例3: loadImage
import io.reactivex.CompletableSource; //导入依赖的package包/类
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 {
}
});
}
示例4: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
@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());
}
}));
}
示例5: animateTogether
import io.reactivex.CompletableSource; //导入依赖的package包/类
public static Completable animateTogether(final CompletableSource... completables) {
return Completable.mergeArray(completables);
}
示例6: AttachDisposableCompletable
import io.reactivex.CompletableSource; //导入依赖的package包/类
/**
* @param source the consumable CompletableSource
* @param compositeDisposable the composite disposable
*/
public AttachDisposableCompletable(CompletableSource source, CompositeDisposable compositeDisposable) {
this.source = source;
this.compositeDisposable = compositeDisposable;
}
示例7: source
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public final CompletableSource source() {
return source;
}
示例8: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
}
示例9: CompletableIfThen
import io.reactivex.CompletableSource; //导入依赖的package包/类
CompletableIfThen(BooleanSupplier condition, CompletableSource then,
CompletableSource orElse) {
this.condition = condition;
this.then = then;
this.orElse = orElse;
}
示例10: source
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource source() {
return mSource;
}
示例11: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
return upstream.toObservable()
.compose(new DelayReplayObservableTransformer<>(pauseLifecycle))
.ignoreElements();
}
示例12: AutoDisposeCompletable
import io.reactivex.CompletableSource; //导入依赖的package包/类
AutoDisposeCompletable(CompletableSource source, Maybe<?> scope) {
this.source = source;
this.scope = scope;
}
示例13: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
return observableCache.cacheCompletable(key, upstream);
}
示例14: evaluateDeck
import io.reactivex.CompletableSource; //导入依赖的package包/类
@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();
}
}
}
});
}
};
}
});
}
示例15: apply
import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
return ((Observable<T>) apply(upstream.<T>toObservable())).ignoreElements();
}