本文整理匯總了Java中io.reactivex.Observer.onSubscribe方法的典型用法代碼示例。如果您正苦於以下問題:Java Observer.onSubscribe方法的具體用法?Java Observer.onSubscribe怎麽用?Java Observer.onSubscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.reactivex.Observer
的用法示例。
在下文中一共展示了Observer.onSubscribe方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(
Observer<? super ObservableArrayListItemRangeRemovalEvent<T>> observer) {
if (!checkMainThread(observer)) {
return;
}
Listener listener = new Listener(observableArrayList, observer);
observer.onSubscribe(listener);
observableArrayList.addOnListChangedCallback(listener.onListChangedCallback);
}
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:11,代碼來源:ObservableArrayListItemRangeRemovalEventObservable.java
示例2: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override protected void subscribeActual(Observer<? super Long> observer) {
if (!checkMainThread(observer)) {
return;
}
Listener listener = new Listener(observableLong, observer);
observer.onSubscribe(listener);
observableLong.addOnPropertyChangedCallback(listener.onPropertyChangedCallback);
}
示例3: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super Event> observer) {
if (!Preconditions.checkDisplay(observer, display)) {
return;
}
DisplayListener listener = new DisplayListener(display, eventType, observer);
observer.onSubscribe(listener);
display.addListener(SWT.Dispose, e -> listener.dispose());
addlistener(listener);
}
示例4: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super StateChangeEvent> observer) {
if (!Preconditions.checkMainThread(observer)) {
return;
}
Listener listener = new Listener(button, observer);
observer.onSubscribe(listener);
button.setOnStateChangeListener(listener);
}
示例5: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override protected void subscribeActual(Observer<? super Response<T>> observer) {
// Since Call is a one-shot type, clone it for each new observer.
Call<T> call = originalCall.clone();
CallCallback<T> callback = new CallCallback<>(call, observer);
observer.onSubscribe(callback);
call.enqueue(callback);
}
示例6: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super Response<T>> observer) {
// Since Call is a one-shot type, clone it for each new observer.
Call<T> call = originalCall.clone();
observer.onSubscribe(new CallDisposable(call));
boolean terminated = false;
try {
Response<T> response = call.execute();
if (!call.isCanceled()) {
observer.onNext(response);
}
if (!call.isCanceled()) {
terminated = true;
observer.onComplete();
}
} catch (Throwable t) {
Exceptions.throwIfFatal(t);
if (terminated) {
RxJavaPlugins.onError(t);
} else if (!call.isCanceled()) {
try {
observer.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaPlugins.onError(new CompositeException(t, inner));
}
}
}
}
示例7: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override protected void subscribeActual(Observer<? super Boolean> observer) {
if (!checkMainThread(observer)) {
return;
}
Listener listener = new Listener(observableBoolean, observer);
observer.onSubscribe(listener);
observableBoolean.addOnPropertyChangedCallback(listener.onPropertyChangedCallback);
}
示例8: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(
Observer<? super ObservableArrayListItemRangeChangeEvent<T>> observer) {
if (!checkMainThread(observer)) {
return;
}
Listener listener = new Listener(observableArrayList, observer);
observer.onSubscribe(listener);
observableArrayList.addOnListChangedCallback(listener.onListChangedCallback);
}
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:11,代碼來源:ObservableArrayListItemRangeChangeEventObservable.java
示例9: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super DisposeEvent> observer) {
if (!Preconditions.checkWidget(observer, widget)) {
return;
}
RxDisposeListener listener = new RxDisposeListener(widget, observer);
observer.onSubscribe(listener);
widget.addDisposeListener(e -> listener.dispose());
widget.addDisposeListener(listener);
}
示例10: wrapObserver
import io.reactivex.Observer; //導入方法依賴的package包/類
public static <T> Observer<T> wrapObserver(Observer<T> observer, IRxBusQueue isResumedProvider)
{
return new Observer<T>()
{
@Override
public void onSubscribe(Disposable d) {
observer.onSubscribe(d);
}
@Override
public void onComplete()
{
observer.onComplete();
}
@Override
public void onError(Throwable e)
{
observer.onError(e);
}
@Override
public void onNext(T t)
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
observer.onNext(t);
}
};
}
示例11: wrapObserver
import io.reactivex.Observer; //導入方法依賴的package包/類
public static <T> Observer<T> wrapObserver(Observer<T> observer, IRxBusQueue isResumedProvider)
{
return new Observer<T>()
{
@Override
public void onSubscribe(Disposable d) {
observer.onSubscribe(d);
}
@Override
public void onComplete()
{
observer.onComplete();
}
@Override
public void onError(Throwable e)
{
observer.onError(e);
}
@Override
public void onNext(T t)
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
observer.onNext(t);
}
};
}
示例12: wrap
import io.reactivex.Observer; //導入方法依賴的package包/類
/**
* @see Observable#subscribe(Observer)
*/
public <T> Observer<? super T> wrap(final Observer<? super T> observer) {
LambdaObserver<? super T> disposableObserver = new LambdaObserver<>(
new Consumer<T>() {
@Override
public void accept(T t) throws Exception {
observer.onNext(t);
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
observer.onError(throwable);
}
},
new Action() {
@Override
public void run() throws Exception {
observer.onComplete();
}
},
new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
observer.onSubscribe(disposable);
}
}
);
return handleObserver(disposableObserver);
}
示例13: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super TapEvent> observer) {
if (!Preconditions.checkMainThread(observer)) {
return;
}
Listener listener = new Listener(button, observer);
observer.onSubscribe(listener);
button.setOnTapEventListener(listener);
}
示例14: testWrapObserver
import io.reactivex.Observer; //導入方法依賴的package包/類
@Test
public void testWrapObserver() throws Exception {
String testString = "test";
Throwable testThrowable = mock(Throwable.class);
Disposable testDisposable = mock(Disposable.class);
Observer<? super String> testObserver = mockSubscriptionDecorator.wrap(mockObserver);
validateDisposableDelegated(testObserver);
testObserver.onNext(testString);
verify(mockObserver, times(1))
.onNext(testString);
testObserver.onError(testThrowable);
verify(mockObserver, times(1))
.onError(testThrowable);
testObserver = mockSubscriptionDecorator.wrap(mockObserver);
testObserver.onComplete();
verify(mockObserver, times(1))
.onComplete();
testObserver = mockSubscriptionDecorator.wrap(mockObserver);
testObserver.onSubscribe(testDisposable);
verify(mockObserver, times(1))
.onSubscribe(argThat(validateDisposeIsDelegated(testDisposable)));
}
示例15: subscribeActual
import io.reactivex.Observer; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super MouseEvent> observer) {
if (!Preconditions.checkWidget(observer, control)) {
return;
}
RxMouseMoveListener listener = getMouseListener(control, observer);
observer.onSubscribe(listener);
control.addDisposeListener(e -> listener.dispose());
control.addMouseMoveListener(listener);
}