当前位置: 首页>>代码示例>>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;未经允许,请勿转载。