当前位置: 首页>>代码示例>>Java>>正文


Java CompletableSource类代码示例

本文整理汇总了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));
}
 
开发者ID:MobileTribe,项目名称:pandroid,代码行数:10,代码来源:MainObserverTransformer.java

示例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());
        }
    }));
}
 
开发者ID:MobileTribe,项目名称:pandroid,代码行数:16,代码来源:RxLifecycleTransformer.java

示例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 {
        }
      });
}
 
开发者ID:IsseiAoki,项目名称:SimpleCropView,代码行数:30,代码来源:RxFragment.java

示例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());
        }
    }));
}
 
开发者ID:satorufujiwara,项目名称:recyclerview-binder,代码行数:10,代码来源:LifecycleTransformer.java

示例5: animateTogether

import io.reactivex.CompletableSource; //导入依赖的package包/类
public static Completable animateTogether(final CompletableSource... completables) {
    return Completable.mergeArray(completables);
}
 
开发者ID:0ximDigital,项目名称:Rx2Animations,代码行数:4,代码来源:RxAnimations.java

示例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;
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:9,代码来源:AttachDisposableCompletable.java

示例7: source

import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public final CompletableSource source() {
    return source;
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:5,代码来源:AttachDisposableCompletable.java

示例8: apply

import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
    return Completable.ambArray(upstream, observable.flatMapCompletable(Functions.CANCEL_COMPLETABLE));
}
 
开发者ID:xufreshman,项目名称:RxLifeCycle,代码行数:5,代码来源:LifecycleTransformer.java

示例9: CompletableIfThen

import io.reactivex.CompletableSource; //导入依赖的package包/类
CompletableIfThen(BooleanSupplier condition, CompletableSource then,
                  CompletableSource orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
 
开发者ID:fengzhizi715,项目名称:RxConditions,代码行数:7,代码来源:CompletableIfThen.java

示例10: source

import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource source() {
    return mSource;
}
 
开发者ID:roadhouse-dev,项目名称:RxDbflow,代码行数:5,代码来源:NotifyOfUpdate.java

示例11: apply

import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
    return upstream.toObservable()
            .compose(new DelayReplayObservableTransformer<>(pauseLifecycle))
            .ignoreElements();
}
 
开发者ID:Plastix,项目名称:RxDelay,代码行数:7,代码来源:DelayCompletableTransformer.java

示例12: AutoDisposeCompletable

import io.reactivex.CompletableSource; //导入依赖的package包/类
AutoDisposeCompletable(CompletableSource source, Maybe<?> scope) {
  this.source = source;
  this.scope = scope;
}
 
开发者ID:uber,项目名称:AutoDispose,代码行数:5,代码来源:CompletableScoper.java

示例13: apply

import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
    return observableCache.cacheCompletable(key, upstream);
}
 
开发者ID:AleksanderMielczarek,项目名称:ObservableCache,代码行数:5,代码来源:CacheableCompletable.java

示例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();
                                        }
                                    }
                                }
                            });
                }
            };
        }
    });
}
 
开发者ID:jamieadkins95,项目名称:Roach,代码行数:59,代码来源:Deck.java

示例15: apply

import io.reactivex.CompletableSource; //导入依赖的package包/类
@Override
public CompletableSource apply(Completable upstream) {
    return ((Observable<T>) apply(upstream.<T>toObservable())).ignoreElements();
}
 
开发者ID:alapshin,项目名称:arctor,代码行数:5,代码来源:WaitViewLatestTransformer.java


注:本文中的io.reactivex.CompletableSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。