當前位置: 首頁>>代碼示例>>Java>>正文


Java ObservableEmitter.setCancellable方法代碼示例

本文整理匯總了Java中io.reactivex.ObservableEmitter.setCancellable方法的典型用法代碼示例。如果您正苦於以下問題:Java ObservableEmitter.setCancellable方法的具體用法?Java ObservableEmitter.setCancellable怎麽用?Java ObservableEmitter.setCancellable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.ObservableEmitter的用法示例。


在下文中一共展示了ObservableEmitter.setCancellable方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addEmitter

import io.reactivex.ObservableEmitter; //導入方法依賴的package包/類
public void addEmitter(@NonNull final ObservableEmitter<Integer> emitter) {
  emitterList.add(emitter);
  emitter.setCancellable(new Cancellable() {
    @Override
    public void cancel() throws Exception {
      emitterList.remove(emitter);
    }
  });
  emitMissingLifecycle(emitter);
}
 
開發者ID:seven332,項目名稱:Stage,代碼行數:11,代碼來源:SceneLifecycleListener.java

示例2: subscribe

import io.reactivex.ObservableEmitter; //導入方法依賴的package包/類
@Override
        public void subscribe(ObservableEmitter<RealmResults<T>> emitter) throws Exception {
            // Initial element.
            emitter.onNext(realmResults);

// We don't catch changes without the resulst set since our adapter does this automatically.
            // Notify on changes.
            RealmChangeListener<RealmResults<T>> changeListener = element -> emitter.onNext(element);
            realmResults.addChangeListener(changeListener);

            // Make sure we don't listen to the changes when we are no longer interested.
            emitter.setCancellable(() -> realmResults.removeChangeListener(changeListener));
        }
 
開發者ID:aprochukhan,項目名稱:Android-MVVM-Example,代碼行數:14,代碼來源:RxRealm.java

示例3: subscribe

import io.reactivex.ObservableEmitter; //導入方法依賴的package包/類
@Override
public void subscribe(ObservableEmitter<STATE> emitter) throws Exception {

  //the internal listener to the store.
  Store.StateChangeListener<STATE> listener =
      emitter::onNext;
  emitter.setCancellable(() -> store.unsubscribe(listener));
  store.subscribe(listener);
}
 
開發者ID:groupon,項目名稱:grox,代碼行數:10,代碼來源:StoreOnSubscribe.java

示例4: subscribe

import io.reactivex.ObservableEmitter; //導入方法依賴的package包/類
@Override
public void subscribe(final ObservableEmitter<RxNetworkInfo> emitter) throws Exception {
  broadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
      emitter.onNext(RxNetworkInfo.create(context));
    }
  };

  emitter.setCancellable(new StrategyCancellable());
  register();
}
 
開發者ID:greyfoxit,項目名稱:RxNetwork,代碼行數:13,代碼來源:PreLollipopNetworkObservingStrategy.java

示例5: subscribe

import io.reactivex.ObservableEmitter; //導入方法依賴的package包/類
@Override
public void subscribe(final ObservableEmitter<RxNetworkInfo> upstream) throws Exception {
  networkCallback = new StrategyNetworkCallback(upstream);
  upstream.setCancellable(new StrategyCancellable());
  register();
}
 
開發者ID:greyfoxit,項目名稱:RxNetwork,代碼行數:7,代碼來源:LollipopNetworkObservingStrategy.java

示例6: subscribe

import io.reactivex.ObservableEmitter; //導入方法依賴的package包/類
@Override
public void subscribe(final ObservableEmitter<RxNetworkInfo> upstream) throws Exception {
  upstream.setCancellable(new StrategyCancellable());
  registerIdleModeReceiver(upstream);
  registerNetworkCallback(upstream);
}
 
開發者ID:greyfoxit,項目名稱:RxNetwork,代碼行數:7,代碼來源:MarshmallowNetworkObservingStrategy.java


注:本文中的io.reactivex.ObservableEmitter.setCancellable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。