当前位置: 首页>>代码示例>>Java>>正文


Java Observer.onNext方法代码示例

本文整理汇总了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());
          }
        }
      };
}
 
开发者ID:oldergod,项目名称:RxDataBinding,代码行数:15,代码来源:ObservableDoubleObservable.java

示例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();
            }
        }
    };
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:37,代码来源:EthplorerTokenService.java

示例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);
			}
		}
	};
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:12,代码来源:FocusLostObservable.java

示例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);
			}
		}
	};
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:12,代码来源:KeyReleasedObservable.java

示例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()));
    }
}
 
开发者ID:aritraroy,项目名称:PatternLockView,代码行数:8,代码来源:PatternLockViewProgressObservable.java

示例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()));
    }
}
 
开发者ID:aritraroy,项目名称:PatternLockView,代码行数:9,代码来源:PatternLockViewCompoundObservable.java

示例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());
          }
        }
      };
}
 
开发者ID:oldergod,项目名称:RxDataBinding,代码行数:15,代码来源:ObservableByteObservable.java

示例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());
          }
        }
      };
}
 
开发者ID:oldergod,项目名称:RxDataBinding,代码行数:15,代码来源:ObservableFieldObservable.java

示例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);
			}
		}
	};
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:12,代码来源:MouseDoubleClickObservable.java

示例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);
		}
	};
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:10,代码来源:MouseEnterObservable.java

示例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);
}
 
开发者ID:jzallas,项目名称:RxDisposal,代码行数:34,代码来源:SubscriptionDecorator.java

示例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);
			}
		}
	};
}
 
开发者ID:SimonScholz,项目名称:RxSWT,代码行数:12,代码来源:FocusGainedObservable.java

示例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();
}
 
开发者ID:Zackratos,项目名称:RxToast,代码行数:10,代码来源:ToastObservable.java

示例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));
            }
        }
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:31,代码来源:CallExecuteObservable.java


注:本文中的io.reactivex.Observer.onNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。