io.reactivex.subjects.Subject.distinctUntilChanged()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中io.reactivex.subjects.Subject.distinctUntilChanged()方法的一些代码示例,展示了Subject.distinctUntilChanged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.distinctUntilChanged()方法的具体详情如下:
包路径:io.reactivex.subjects.Subject
类名称:Subject
方法名:distinctUntilChanged

Subject.distinctUntilChanged介绍

暂无

代码示例

代码示例来源:origin: oVirt/moVirt

@Override
  public DashboardPresenter initialize() {
    super.initialize();

    getDisposables().add(rxStore.ACTIVE_SELECTION
        .distinctUntilChanged()
        .subscribeOn(Schedulers.computation())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(selection -> {
          getView().displayStatus(selection);
        }));

    return this;
  }
}

代码示例来源:origin: oVirt/moVirt

@AfterViews
protected void afterViewsInit() {
  disposables.add(rxStore.ACTIVE_SELECTION.distinctUntilChanged()
      .switchMap(activeSelection -> rxStore.isSyncInProgressObservable(activeSelection.getAccount()))
      .onErrorReturnItem(new SyncStatus(false))
      .subscribeOn(Schedulers.computation())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(syncStatus -> {
        if (syncStatus.isInProgress()) {
          showProgressBar();
        } else {
          hideProgressBar();
        }
      }));
}

代码示例来源:origin: oVirt/moVirt

@Override
public VirtualDashboardPresenter initialize() {
  super.initialize();
  getDisposables().add(rxStore.ACTIVE_SELECTION
      .distinctUntilChanged()
      .switchMap(selection -> {
        final Observable<List<Vm>> vms = querySelection(providerFacade, Vm.class, selection)
            .where(STATUS, VmStatus.UP.toString())
            .asObservable();
        final Observable<List<Disk>> disks = querySelection(providerFacade, Disk.class, selection)
            .asObservable();
        return Observable.combineLatest(vms, disks, Wrapper::new);
      })
      .map(this::process)
      .subscribeOn(Schedulers.computation())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(this::render));
  return this;
}

代码示例来源:origin: oVirt/moVirt

@Override
public PhysicalDashboardPresenter initialize() {
  super.initialize();
  getDisposables().add(rxStore.ACTIVE_SELECTION
      .distinctUntilChanged()
      .switchMap(selection -> {
        final Observable<List<Host>> hosts = querySelection(providerFacade, Host.class, selection).asObservable();
        final Observable<List<Vm>> vms = querySelection(providerFacade, Vm.class, selection).asObservable();
        final Observable<List<StorageDomain>> storages = querySelection(providerFacade, StorageDomain.class, selection)
            .where(StorageDomain.STATUS, StorageDomainStatus.ACTIVE.toString())
            .where(StorageDomain.TYPE, StorageDomainType.DATA.toString())
            .asObservable();
        return Observable.combineLatest(hosts, vms, storages, Wrapper::new);
      })
      .map(this::process)
      .subscribeOn(Schedulers.computation())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(this::render));
  return this;
}

代码示例来源:origin: oVirt/moVirt

@Override
public DashboardBoxPresenter initialize() {
  super.initialize();
  getDisposables().add(rxStore.ACTIVE_SELECTION
      .distinctUntilChanged()
      .subscribeOn(Schedulers.computation())
      .subscribe(selection -> {
        boxDisposables.destroy();
        subscribeTo(selection, DataCenter.class, BoxDataEntity.DATA_CENTER);
        subscribeTo(selection, Cluster.class, BoxDataEntity.CLUSTER);
        subscribeTo(selection, Host.class, BoxDataEntity.HOST);
        subscribeTo(selection, StorageDomain.class, BoxDataEntity.STORAGE_DOMAIN);
        subscribeTo(selection, Vm.class, BoxDataEntity.VM);
        subscribeTo(selection, Event.class, BoxDataEntity.EVENT);
      }));
  return this;
}

代码示例来源:origin: oVirt/moVirt

@AfterInject
void init() {
  setAccounts(accountManagerHelper.getAllAccounts()); // set atomically
  rxStore.ALL_ACCOUNTS.distinctUntilChanged() // and listen
      .subscribeOn(Schedulers.computation())
      .subscribe(accounts -> setAccounts(accounts.getAccounts()));
  rxStore.LOGIN_STATUS.subscribeOn(Schedulers.computation()).subscribe(loginStatus -> {
    final AccountEnvironment environment = environmentMap.get(loginStatus.getAccount());
    if (environment != null) {
      environment.setLoginInProgress(loginStatus.isInProgress());
    }
  });
  rxStore.CERTIFICATE_DOWNLOAD_STATUS.subscribeOn(Schedulers.computation()).subscribe(status -> {
    final AccountEnvironment environment = environmentMap.get(status.getAccount());
    if (environment != null) {
      environment.setCertificateDownloadInProgress(status.isInProgress());
    }
  });
  rxStore.SYNC_STATUS.subscribeOn(Schedulers.computation()).subscribe(syncStatus -> {
    final AccountEnvironment environment = environmentMap.get(syncStatus.getAccount());
    if (environment != null) {
      environment.setInSync(syncStatus.isInProgress());
    }
    ANY_ACCOUNT_IN_SYNC.onNext(isAnyAccountInSync());
  });
}

代码示例来源:origin: oVirt/moVirt

.subscribe(status -> getView().showCertificateDownloadInProgress(status.isInProgress())));
getDisposables().add(certHandlingStrategySubject.distinctUntilChanged()
    .subscribeOn(Schedulers.computation())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(this::onNewCertContext));
getDisposables().add(customCertificateLocationSubject.distinctUntilChanged()
    .subscribeOn(Schedulers.computation())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(customCertificateLocation -> getView().selectCertLocationType(customCertificateLocation)));
getDisposables().add(validHostnamesSubject.distinctUntilChanged()
    .subscribeOn(Schedulers.computation())
    .observeOn(AndroidSchedulers.mainThread())

代码示例来源:origin: oVirt/moVirt

@Override
public MainPresenter initialize() {
  super.initialize();
  Observable<List<Cluster>> clusters = providerFacade.query(Cluster.class)
      .orderBy(Cluster.NAME)
      .asObservable()
      .startWith(Collections.<Cluster>emptyList());
  getDisposables().add(Observable.combineLatest(rxStore.ALL_ACCOUNTS.startWith(AllAccounts.NO_ACCOUNTS), clusters, AccountsClusters::new)
      .subscribeOn(Schedulers.computation())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(accountClusters -> {
        getView().showAccountsAndClusters(accountClusters.getAssigned());
        getView().selectActiveSelection(rxStore.getActiveSelection());
      }));
  getDisposables().add(rxStore.ACTIVE_SELECTION
      .distinctUntilChanged()
      .subscribeOn(Schedulers.computation())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(selection -> {
        getView().selectActiveSelection(selection);
        getView().displayStatus(selection);
      }));
  if (!commonSharedPreferencesHelper.isFirstAccountConfigured()) {
    getView().showAccountDialog();
  }
  return this;
}

代码示例来源:origin: k-kagurazaka/rx-property-android

onErrorsChangedObservable = errorEmitter.distinctUntilChanged().share();
onSummarizedErrorChangedObservable = onErrorsChangedObservable
    .map(new Function<List<String>, String>() {

代码示例来源:origin: oVirt/moVirt

}));
getDisposables().add(menuState.distinctUntilChanged()
    .subscribeOn(Schedulers.computation())
    .observeOn(AndroidSchedulers.mainThread())

代码示例来源:origin: oVirt/moVirt

}));
getDisposables().add(menuState.distinctUntilChanged()
    .subscribeOn(Schedulers.computation())
    .observeOn(AndroidSchedulers.mainThread())

代码示例来源:origin: oVirt/moVirt

ACTIVE_SELECTION.distinctUntilChanged(), SelectionClusters::new)
.subscribeOn(Schedulers.computation())
.subscribe(selectionClusters -> {

相关文章