本文整理匯總了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();
}