本文整理汇总了Java中io.reactivex.Observer.onNext方法的典型用法代码示例。如果您正苦于以下问题:Java Observer.onNext方法的具体用法?Java Observer.onNext怎么用?Java Observer.onNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Observer
的用法示例。
在下文中一共展示了Observer.onNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Listener
import io.reactivex.Observer; //导入方法依赖的package包/类
Listener(final ObservableDouble observableDouble, final Observer<? super Double> observer) {
this.observableDouble = observableDouble;
this.onPropertyChangedCallback =
new android.databinding.Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(android.databinding.Observable observable,
int ignoredPropertyId) {
if (!isDisposed()) {
ObservableDouble observableDouble = (ObservableDouble) observable;
observer.onNext(observableDouble.get());
}
}
};
}
示例2: apply
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
public Observer<? super Response<EthplorerResponse>> apply(Observer<? super EthplorerResponse> observer) throws Exception {
return new DisposableObserver<Response<EthplorerResponse>>() {
@Override
public void onNext(Response<EthplorerResponse> response) {
if (isDisposed()) {
return;
}
EthplorerResponse body = response.body();
if (body != null && body.error == null) {
observer.onNext(body);
observer.onComplete();
} else {
if (body != null) {
observer.onError(new ApiErrorException(new ErrorEnvelope(body.error.code, body.error.message)));
} else {
observer.onError(new ApiErrorException(new ErrorEnvelope(UNKNOWN, "Service not available")));
}
}
}
@Override
public void onError(Throwable e) {
if (!isDisposed()) {
observer.onError(e);
}
}
@Override
public void onComplete() {
if (!isDisposed()) {
observer.onComplete();
}
}
};
}
示例3: getFocusListener
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected AbstractFocusListener getFocusListener(Control control, Observer<? super FocusEvent> observer) {
return new AbstractFocusListener(control) {
@Override
public void focusLost(FocusEvent e) {
if (!isDisposed()) {
observer.onNext(e);
}
}
};
}
示例4: getMouseListener
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected AbstractKeyListener getMouseListener(Control control, Observer<? super KeyEvent> observer) {
return new AbstractKeyListener(control) {
@Override
public void keyReleased(KeyEvent e) {
if (!isDisposed()) {
observer.onNext(e);
}
}
};
}
示例5: subscribeActual
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super PatternLockProgressEvent> observer) {
subscribeListener(observer);
if (mEmitInitialValue) {
observer.onNext(new PatternLockProgressEvent(mPatternLockView.getPattern()));
}
}
示例6: subscribeActual
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super PatternLockCompoundEvent> observer) {
subscribeListener(observer);
if (mEmitInitialValue) {
observer.onNext(new PatternLockCompoundEvent(PatternLockCompoundEvent.EventType.PATTERN_STARTED,
mPatternLockView.getPattern()));
}
}
示例7: Listener
import io.reactivex.Observer; //导入方法依赖的package包/类
Listener(final ObservableByte observableByte, final Observer<? super Byte> observer) {
this.observableByte = observableByte;
this.onPropertyChangedCallback =
new android.databinding.Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(android.databinding.Observable observable,
int ignoredPropertyId) {
if (!isDisposed()) {
ObservableByte observableByte = (ObservableByte) observable;
observer.onNext(observableByte.get());
}
}
};
}
示例8: Listener
import io.reactivex.Observer; //导入方法依赖的package包/类
Listener(final ObservableField<T> observableField, final Observer<? super T> observer) {
this.observableField = observableField;
this.onPropertyChangedCallback =
new android.databinding.Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(android.databinding.Observable observable,
int ignoredPropertyId) {
if (!isDisposed()) {
ObservableField<T> observableField = convert(observable);
observer.onNext(observableField.get());
}
}
};
}
示例9: getMouseListener
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected AbstractMouseListener getMouseListener(Control control, Observer<? super MouseEvent> observer) {
return new AbstractMouseListener(control) {
@Override
public void mouseDoubleClick(MouseEvent e) {
if (!isDisposed()) {
observer.onNext(e);
}
}
};
}
示例10: getMouseListener
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected AbstractMouseTrackListener getMouseListener(Control control, Observer<? super MouseEvent> observer) {
return new AbstractMouseTrackListener(control) {
@Override
public void mouseEnter(MouseEvent e) {
observer.onNext(e);
}
};
}
示例11: 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);
}
示例12: getFocusListener
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected AbstractFocusListener getFocusListener(Control control, Observer<? super FocusEvent> observer) {
return new AbstractFocusListener(control) {
@Override
public void focusGained(FocusEvent e) {
if (!isDisposed()) {
observer.onNext(e);
}
}
};
}
示例13: subscribeActual
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super CharSequence> observer) {
if (!checkMainThread(observer)) {
return;
}
observer.onSubscribe(new Disposable(toast));
observer.onNext(text);
toast.show();
}
示例14: subscribeActual
import io.reactivex.Observer; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super ProgressBean<Response<T>>> observer) {
// Since Call is a one-shot type, clone it for each new observer.
Call<T> call = originalCall.clone();
Utils.replaceToProgressRequestBody(call, this);
observer.onSubscribe(new CallDisposable(call));
mObserver = observer;
boolean terminated = false;
try {
Response<T> response = call.execute();
if (!call.isCanceled()) {
observer.onNext(
new ProgressBean<>(mTotal, mTotal, 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));
}
}
}
}
开发者ID:imfms,项目名称:retrofit-rxjava-request-with-progress,代码行数:38,代码来源:CallExecuteWithProgressObservable.java
示例15: 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));
}
}
}
}