本文整理汇总了Java中rx.subjects.PublishSubject.asObservable方法的典型用法代码示例。如果您正苦于以下问题:Java PublishSubject.asObservable方法的具体用法?Java PublishSubject.asObservable怎么用?Java PublishSubject.asObservable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.subjects.PublishSubject
的用法示例。
在下文中一共展示了PublishSubject.asObservable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import rx.subjects.PublishSubject; //导入方法依赖的package包/类
@NonNull
@Override
public Observable<Long> start() {
final PublishSubject<Long> tickPublisher = PublishSubject.create();
Subscription subscription = serviceConnectionSubject.subscribe(
// The action to take `onNext`, i.e., when `onServiceConnected` is called.
remoteStopwatchService -> {
try {
// Start the remote stopwatch, which is owned by the remote Service
// Passing in the listener for `tick` events to communicate back across process boundaries.
remoteStopwatchService.start(new IStopwatchTickListener.Stub() {
@Override
public void onTick(long tick) throws RemoteException {
tickPublisher.onNext(tick);
}
});
} catch (RemoteException e) {
LogUtil.e(TAG, "RemoteException");
onError(e);
}
}, this::onError, this::onComplete);
subscriptions.add(subscription);
return tickPublisher.asObservable();
}
示例2: recyclerEventObservable
import rx.subjects.PublishSubject; //导入方法依赖的package包/类
@Provides
@PerFragment
public static Observable<RecyclerEvent> recyclerEventObservable(PublishSubject<RecyclerEvent> events) {
return events.asObservable();
}
示例3: menuActionObservable
import rx.subjects.PublishSubject; //导入方法依赖的package包/类
@Provides
public static Observable<AddIngredientMenuAction> menuActionObservable(
PublishSubject<AddIngredientMenuAction> subject) {
return subject.asObservable();
}
示例4: menuActionObservable
import rx.subjects.PublishSubject; //导入方法依赖的package包/类
@Provides
public static Observable<AddMealMenuAction> menuActionObservable(
PublishSubject<AddMealMenuAction> actionPublishSubject) {
return actionPublishSubject.asObservable();
}