本文整理汇总了Java中io.reactivex.annotations.NonNull类的典型用法代码示例。如果您正苦于以下问题:Java NonNull类的具体用法?Java NonNull怎么用?Java NonNull使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NonNull类属于io.reactivex.annotations包,在下文中一共展示了NonNull类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startRefresh
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
@Override
protected void startRefresh(HandleBase<StickyItem> refreshData) {
Flowable.just(refreshData)
.onBackpressureDrop()
.observeOn(Schedulers.computation())
.map(new Function<HandleBase<StickyItem>, DiffUtil.DiffResult>() {
@Override
public DiffUtil.DiffResult apply(@NonNull HandleBase<StickyItem> handleBase) throws Exception {
return handleRefresh(handleBase.getNewData(), handleBase.getNewHeader(), handleBase.getNewFooter(), handleBase.getType(), handleBase.getRefreshType());
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<DiffUtil.DiffResult>() {
@Override
public void accept(@NonNull DiffUtil.DiffResult diffResult) throws Exception {
handleResult(diffResult);
}
});
}
示例2: test0
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
@Override
public void test0() {
Log.i(TAG, "test0() Map simple demo, integer 1,2,3 transform to string 2,4,6");
Observable.just(1, 2, 3).map(new Function<Integer, String>() {
@Override
public String apply(@NonNull Integer integer) throws Exception {
return Integer.toString(integer * 2);
}
}).subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
Log.d(TAG, "Consumer<String> accept() s: " + s);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.d(TAG, "Consumer<Throwable> accept() throwable: " + throwable);
}
}, new Action() {
@Override
public void run() throws Exception {
Log.d(TAG, "Action run() for onComplete()");
}
});
}
示例3: updateEvenStatus
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
private void updateEvenStatus(int status, BIncidentRemark note) {
showProgress();
wrap(ApiHelper.getInstance().updateEventStatus(incidentDto.getId(), status, note)).subscribe(
new BaseObserver<IncidentDto>(EditInfoActivity.this) {
@Override public void onNext(@NonNull IncidentDto responseBody) {
hideProgress();
super.onNext(responseBody);
ToastUtils.showShortSafe("success");
RxBus.getInstance().send(new UpdateEvent(true));
finish();
}
@Override public void onError(@NonNull Throwable e) {
hideProgress();
super.onError(e);
ToastUtils.showShortSafe("failure");
pbClaim.setVisibility(View.GONE);
sl.setVisibility(View.VISIBLE);
}
});
}
示例4: getResultActivity
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
private void getResultActivity()
{
final Intent intent = new Intent(getActivity(), Result.class);
RxActivityResultCompact.startActivityForResult(this, intent, REQUEST_CODE)
.subscribe(new Consumer<ActivityResult>() {
@Override
public void accept(@NonNull ActivityResult result) throws Exception {
if (result.isOk()) {
final String txt = result.getData().getStringExtra(Result.GET_TEXT);
textresult.setText(txt);
}
}
});
}
示例5: checkUpdateIfUsingWifi
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
private Observable<VersionInfo> checkUpdateIfUsingWifi(Context context) {
if (!NetworkUtils.isWifiAvailable(context)) {
return Observable.empty();
}
Observable<VersionInfo> observable = checkForUpdates();
observable.subscribe(new SimpleObserver<VersionInfo>() {
@Override
public void onNext(@NonNull VersionInfo versionInfo) {
if (versionInfo.isValid()) {
setVersionInfo(versionInfo);
}
}
@Override
public void onError(@NonNull Throwable e) {
e.printStackTrace();
}
});
return observable;
}
示例6: testRx
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
private void testRx() {
Observable.just("tony")
.subscribe(new Consumer<String>() {
@HookMethod(beforeMethod = "testRxBefore")
@Override
public void accept(@NonNull String s) throws Exception {
System.out.println("s="+s);
}
private void testRxBefore() {
L.i("testRxBefore() is called before accept()");
}
});
}
示例7: getSearchUserResultFromServer
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
public void getSearchUserResultFromServer(String value){
OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().getSearchUserList(value),
new OvObserver<HttpResult<List<SearchUserBean>>>() {
@Override
protected void setNeedContext() {
setContext(mContext);
}
@Override
protected void setProgress(boolean isShow) {
super.setProgress(false);
}
@Override
protected void _onNext(@NonNull HttpResult<List<SearchUserBean>> listHttpResult) {
mPresenter.showSearchUserList(listHttpResult.getData());
}
@Override
protected void _onError(@NonNull Throwable e) {
mPresenter.showNoSearchResult("该用户不存在");
}
});
}
示例8: takePartInPatyToServer
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
public void takePartInPatyToServer(String partyId,String uid){
OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().takePartInTheParty(partyId, uid),
new OvObserver<HttpResult<String>>() {
@Override
protected void setNeedContext() {
setContext(mContext);
}
@Override
protected void setProgress(boolean isShow) {
super.setProgress(false);
}
@Override
protected void _onNext(@NonNull HttpResult<String> stringHttpResult) {
mPresenter.showTakePartPartyResult(stringHttpResult.getMsg());
}
@Override
protected void _onError(@NonNull Throwable e) {
}
});
}
示例9: test0
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
@Override
public void test0() {
Log.i(TAG, "test0() FlatMap simple demo, integer 1,2,3 transform to string 2,3,4,6,6,9");
Observable.just(1, 2, 3).flatMap(new Function<Integer, ObservableSource<String>>() {
@Override
public ObservableSource<String> apply(@NonNull Integer integer) throws Exception {
return Observable.just(integer * 2 + "", integer * 3 + "");
}
}).subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
Log.d(TAG, "Consumer<String> accept() s: " + s);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.d(TAG, "Consumer<Throwable> accept() throwable: " + throwable);
}
}, new Action() {
@Override
public void run() throws Exception {
Log.d(TAG, "Action run() for onComplete()");
}
});
}
示例10: debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
@Test
public void debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug() {
InternalConfiguration config = InternalConfiguration
.getInstance("debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug");
config.setDebugging(false);
final boolean[] result = {false};
new Chain<>(new TestClass(), config)
.debug(new Consumer<TestClass>() {
@Override
public void accept(@NonNull TestClass testClass) throws Exception {
result[0] = true;
}
});
assertFalse(result[0]);
}
示例11: reduceWithMultipleItemsThenReturnFunctionResult
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
@Test
public void reduceWithMultipleItemsThenReturnFunctionResult() {
boolean result = new Collector<Boolean>(configuration)
.and(true)
.and(false)
.and(true)
.reduce(new BiFunction<Boolean, Boolean, Boolean>() {
@Override
public Boolean apply(@NonNull Boolean itemOne, @NonNull Boolean itemTwo) {
return itemOne.equals(itemTwo);
}
})
.call();
assertFalse(result);
}
示例12: addConcernToServer
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
public void addConcernToServer(String userId,String userById){
OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().addConcern(userId, userById),
new OvObserver<HttpResult<String>>() {
@Override
protected void setNeedContext() {
setContext(mContext);
}
@Override
protected void setProgress(boolean isShow) {
super.setProgress(false);
}
@Override
protected void _onNext(@NonNull HttpResult<String> stringHttpResult) {
if (stringHttpResult.getStatus()==1){
mPresenter.showAddConcern(stringHttpResult.getData());
}
}
@Override
protected void _onError(@NonNull Throwable e) {
}
});
}
示例13: executeMiddleware
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
private <TAction extends Action> void executeMiddleware(@NonNull final TAction action) {
if (mMiddlewareList.size() > 0) {
synchronized (mMiddlewareSyncRoot) {
Observable.fromIterable(mMiddlewareList)
.flatMap(new Function<Middleware, ObservableSource<? extends Action>>() {
@Override
public ObservableSource<? extends Action> apply(@NonNull Middleware middleware) throws Exception {
return middleware.process(action);
}
})
.subscribe(new Consumer<Action>() {
@Override
public void accept(@NonNull Action resultAction) throws Exception {
dispatch(resultAction);
}
},
new Consumer<Throwable>() {
@Override
public void accept(@NonNull Throwable throwable) throws Exception {
onMiddlewareError(throwable);
}
});
}
}
}
示例14: loadData
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
private void loadData() {
if (!NetworkUtils.avaliable()) {
showNetworkError();
return;
}
Flowable.fromCallable(new Callable<String>() {
@Override
public String call() throws Exception {
Thread.sleep(3000); // imitate expensive computation
return "Done";
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<String>() {
@Override
public void accept(@NonNull String s) throws Exception {
Log.i("LeftFragment", "data received");
showEmptyData();
}
});
}
示例15: loadMorePostLists
import io.reactivex.annotations.NonNull; //导入依赖的package包/类
/**
* 获取更多数据
*/
public void loadMorePostLists(){
++mMoreNum;
OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().getNewPostList(uid,String.valueOf(mMoreNum), "10"), new OvObserver<HttpResult<List<PostBean>>>() {
@Override
protected void setNeedContext() {
setContext(mPresenter.getContext());
}
@Override
protected void _onNext(@NonNull HttpResult<List<PostBean>> httpResult) {
if (httpResult.getData()!=null && httpResult.getData().size()>0){
mPresenter.loadMorePostsSuccess(httpResult.getData());
}else {
mPresenter.loadMorePostNothing();
}
}
@Override
protected void _onError(@NonNull Throwable e) {
mPresenter.loadMorePostFailue();
}
});
}