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


Java ErrorHandleSubscriber类代码示例

本文整理汇总了Java中me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber的典型用法代码示例。如果您正苦于以下问题:Java ErrorHandleSubscriber类的具体用法?Java ErrorHandleSubscriber怎么用?Java ErrorHandleSubscriber使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorHandleSubscriber类属于me.jessyan.rxerrorhandler.handler包,在下文中一共展示了ErrorHandleSubscriber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: callPhone

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
     * 请求打电话权限
     */
    public static void callPhone(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
//先确保是否已经申请过权限
        boolean isPermissionsGranted =
                rxPermissions
                        .isGranted(Manifest.permission.CALL_PHONE);

        if (isPermissionsGranted) {//已经申请过,直接执行操作
            requestPermission.onRequestPermissionSuccess();
        } else {//没有申请过,则申请
            rxPermissions
                    .request(Manifest.permission.CALL_PHONE)
                    .compose(PermissionUtil.<Boolean>bindToLifecycle(view))//使用RXlifecycle,使subscription和activity一起销毁
                    .subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
                        @Override
                        public void onNext(Boolean granted) {
                            if (granted) {
                                Timber.tag(TAG).d("request SEND_SMS success");
                                requestPermission.onRequestPermissionSuccess();
                            } else {
                                view.showMessage("request permissons failure");
                            }
                        }
                    });
        }
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:29,代码来源:PermissionUtil.java

示例2: externalStorage

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
 * 请求外部存储的权限
 */
public static void externalStorage(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
    //先确保是否已经申请过摄像头,和写入外部存储的权限
    boolean isPermissionsGranted =
            rxPermissions
                    .isGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE);

    if (isPermissionsGranted) {//已经申请过,直接执行操作
        requestPermission.onRequestPermissionSuccess();
    } else {//没有申请过,则申请
        rxPermissions
                .request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
                .subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
                    @Override
                    public void onNext(Boolean granted) {
                        if (granted) {
                            Timber.tag(TAG).d("request WRITE_EXTERNAL_STORAGE and CAMERA success");
                            requestPermission.onRequestPermissionSuccess();
                        } else {
                            view.showMessage("request permissons failure");
                        }
                    }
                });
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PermissionUtil.java

示例3: getTabs

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void getTabs() {
        mModel.getTab2Tabs()
                .subscribeOn(Schedulers.io())
                .retryWhen(new RetryWithDelay(NeiHanConfig.NETWORK_RETRY_TIMES, NeiHanConfig.NETWORK_RETRY_DELAYSECOND))
//                .doOnSubscribe(disposable ->
//                        mRootView.showLoading())
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
//                .doFinally(() ->
//                        mRootView.hideLoading()
//                )
                .compose(RxUtils.bindToLifecycle(mRootView))
                .subscribe(new ErrorHandleSubscriber<ArrayList<HomeTabBean>>(mErrorHandler) {
                    @Override
                    public void onNext(@NonNull ArrayList<HomeTabBean> homeTabBeen) {
                        setData(homeTabBeen);
                    }
                });
    }
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:20,代码来源:MainTab2Presenter.java

示例4: callPhone

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
     * 请求打电话权限
     */
    public static void callPhone(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
//先确保是否已经申请过权限
        boolean isPermissionsGranted =
                rxPermissions
                        .isGranted(Manifest.permission.CALL_PHONE);

        if (isPermissionsGranted) {//已经申请过,直接执行操作
            requestPermission.onRequestPermissionSuccess();
        } else {//没有申请过,则申请
            rxPermissions
                    .request(Manifest.permission.CALL_PHONE)
                    .subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
                        @Override
                        public void onNext(Boolean granted) {
                            if (granted) {
                                Timber.tag(TAG).d("request SEND_SMS success");
                                requestPermission.onRequestPermissionSuccess();
                            } else {
                                view.showMessage("request permissons failure");
                            }
                        }
                    });
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PermissionUtil.java

示例5: readPhonestate

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
     * 请求获取手机状态的权限
     */
    public static void readPhonestate(final RequestPermission requestPermission, RxPermissions rxPermissions, RxErrorHandler errorHandler) {
//先确保是否已经申请过权限
        boolean isPermissionsGranted =
                rxPermissions
                        .isGranted(Manifest.permission.READ_PHONE_STATE);

        if (isPermissionsGranted) {//已经申请过,直接执行操作
            requestPermission.onRequestPermissionSuccess();
        } else {//没有申请过,则申请
            rxPermissions
                    .request(Manifest.permission.READ_PHONE_STATE)
                    .subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
                        @Override
                        public void onNext(Boolean granted) {
                            if (granted) {
                                Timber.tag(TAG).d("request SEND_SMS success");
                                requestPermission.onRequestPermissionSuccess();
                            } else {
                                Timber.tag(TAG).e("request permissons failure");
                            }
                        }
                    });
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PermissionUtil.java

示例6: externalStorage

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
 * 请求外部存储的权限
 */
public static void externalStorage(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
    //先确保是否已经申请过摄像头,和写入外部存储的权限
    boolean isPermissionsGranted =
            rxPermissions
                    .isGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE);

    if (isPermissionsGranted) {//已经申请过,直接执行操作
        requestPermission.onRequestPermissionSuccess();
    } else {//没有申请过,则申请
        rxPermissions
                .request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
                .compose(PermissionUtil.<Boolean>bindToLifecycle(view))//使用RXlifecycle,使subscription和activity一起销毁
                .subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
                    @Override
                    public void onNext(Boolean granted) {
                        if (granted) {
                            Timber.tag(TAG).d("request WRITE_EXTERNAL_STORAGE and CAMERA success");
                            requestPermission.onRequestPermissionSuccess();
                        } else {
                            view.showMessage("request permissons failure");
                        }
                    }
                });
    }
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:29,代码来源:PermissionUtil.java

示例7: sendSms

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
     * 请求发送短信权限
     */
    public static void sendSms(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
//先确保是否已经申请过权限
        boolean isPermissionsGranted =
                rxPermissions
                        .isGranted(Manifest.permission.SEND_SMS);

        if (isPermissionsGranted) {//已经申请过,直接执行操作
            requestPermission.onRequestPermissionSuccess();
        } else {//没有申请过,则申请
            rxPermissions
                    .request(Manifest.permission.SEND_SMS)
                    .compose(PermissionUtil.<Boolean>bindToLifecycle(view))//使用RXlifecycle,使subscription和activity一起销毁
                    .subscribe(new ErrorHandleSubscriber<Boolean>(errorHandler) {
                        @Override
                        public void onNext(Boolean granted) {
                            if (granted) {
                                Timber.tag(TAG).d("request SEND_SMS success");
                                requestPermission.onRequestPermissionSuccess();
                            } else {
                                view.showMessage("request permissons failure");
                            }
                        }
                    });
        }
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:29,代码来源:PermissionUtil.java

示例8: requestUserDetail

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void requestUserDetail() {
    mModel.getUserDetail()
            .subscribeOn(Schedulers.io())
            .retryWhen(new RetryWithDelay(3, 2))
            .subscribeOn(AndroidSchedulers.mainThread())
            .observeOn(AndroidSchedulers.mainThread())
            .compose(RxUtils.<BaseJson<UserDetail>>bindToLifecycle(mRootView))
            .subscribe(new ErrorHandleSubscriber<BaseJson<UserDetail>>(mErrorHandler) {
                @Override
                public void onNext(BaseJson<UserDetail> userDetailBaseJson) {
                    if (userDetailBaseJson.getStatus() == 0) {
                        UserDetail data = userDetailBaseJson.getData();
                        mRootView.setUserDetail(data);
                    } else {
                        mRootView.showMessage(userDetailBaseJson.getMsgs());
                    }
                }
            });
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:20,代码来源:FragmentPresenter.java

示例9: requestUploadIdcard

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void requestUploadIdcard(Bitmap idcarda, Bitmap idcardb) {

        mModel.uploadIdCard(idcarda, idcardb)
                .subscribeOn(Schedulers.io())
//                .retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ErrorHandleSubscriber<BaseJson<JsonObject>>(mErrorHandler) {
                    @Override
                    public void onNext(BaseJson<JsonObject> listBaseJson) {
                        if (listBaseJson.getStatus() == 0) {
                            mRootView.deleteTempPicture();
                        } else {
                            mRootView.showMessage(listBaseJson.getMsgs());
                            mRootView.deleteTempPicture();
                        }
                    }

                    @Override
                    public void onError(Throwable e) {
                        mRootView.showMessage("网络超时!请重试");
                    }
                });
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:25,代码来源:AddressPresenter.java

示例10: setdefault

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void setdefault(int position) {
    Address objAddress = mAddresses.get(position);
    if (objAddress.getId() <= 0) {
        mRootView.showMessage("请选择设置项");
        return;
    }
    mModel.setDefaultAddress(objAddress.getId())
            .subscribeOn(Schedulers.io())
            .retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
            .subscribeOn(AndroidSchedulers.mainThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new ErrorHandleSubscriber<BaseJson<String>>(mErrorHandler) {
                @Override
                public void onNext(BaseJson<String> listBaseJson) {
                    mRootView.showMessage(listBaseJson.getMsgs());
                    requestAddress(true);
                }
            });
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:20,代码来源:AddressPresenter.java

示例11: requestAddressDetail

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void requestAddressDetail(int id) {

        mModel.getAddressDetail(id)
                .subscribeOn(Schedulers.io())
                .retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ErrorHandleSubscriber<BaseJson<Address>>(mErrorHandler) {
                    @Override
                    public void onNext(BaseJson<Address> listBaseJson) {
                        if (listBaseJson.getStatus() == 0) {
                            mRootView.setAddressDetail(listBaseJson.getData());
                        } else {
                            mRootView.showMessage(listBaseJson.getMsgs());
                        }
                    }
                });
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:19,代码来源:AddressPresenter.java

示例12: requestAddressImage

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
/**
 * 请求身份证图片
 * @param i
 * @param url
 */
public void requestAddressImage(int i, String url) {
    mModel.getAddressImage(url)
            .subscribeOn(Schedulers.io())
            .retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
            .subscribeOn(AndroidSchedulers.mainThread())
            .observeOn(AndroidSchedulers.mainThread())
            .compose(RxUtils.<BaseJson<String>>bindToLifecycle(mRootView))//使用RXlifecycle,使subscription和activity一起销毁
            .subscribe(new ErrorHandleSubscriber<BaseJson<String>>(mErrorHandler) {
                @Override
                public void onNext(BaseJson<String> jsonObjectBaseJson) {
                    if (jsonObjectBaseJson.getStatus() == 0) {
                        mRootView.setImage(i,jsonObjectBaseJson.getData());
                    } else {
                        mRootView.showMessage(jsonObjectBaseJson.getMsgs());
                    }
                }
            });
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:24,代码来源:AddressPresenter.java

示例13: requestRegister

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void requestRegister(String name, String email, String pwd, String code, String invite) {
    mModel.register(name, email, pwd, code, invite)
            .subscribeOn(Schedulers.io())
            .retryWhen(new RetryWithDelay(3, 2))
            .subscribeOn(AndroidSchedulers.mainThread())
            .observeOn(AndroidSchedulers.mainThread())
            .compose(RxUtils.<BaseJson<JsonObject>>bindToLifecycle(mRootView))
            .subscribe(new ErrorHandleSubscriber<BaseJson<JsonObject>>(mErrorHandler) {
                           @Override
                           public void onNext(BaseJson<JsonObject> jsonObjectBaseJson) {
                               if (jsonObjectBaseJson.getStatus() == 0) {

                                   mRootView.UserResult(jsonObjectBaseJson.getData());
                               } else {
                                   mRootView.showMessage(jsonObjectBaseJson.getMsgs());
                               }
                           }

                           @Override
                           public void onError(Throwable e) {
                               super.onError(e);
                           }
                       }
            );
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:26,代码来源:UserPresenter.java

示例14: requestTabs

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void requestTabs() {
    mModel.getTabs()
            .subscribeOn(Schedulers.io())
            .retryWhen(new RetryWithDelay(3, 2))//遇到错误时重试,第一个参数为重试几次,第二个参数为重试的间隔
            .doOnSubscribe(disposable -> {
            }).subscribeOn(AndroidSchedulers.mainThread())
            .observeOn(AndroidSchedulers.mainThread())
            .doAfterTerminate(() -> {
            })
            .compose(RxUtils.bindToLifecycle(mRootView))//使用RXlifecycle,使subscription和activity一起销毁
            .subscribe(new ErrorHandleSubscriber<List<TabsBean>>(mErrorHandler) {
                @Override
                public void onNext(List<TabsBean> tabsBeanList) {
                    mRootView.setTabs(tabsBeanList);
                }
            });
}
 
开发者ID:hshare,项目名称:MVPArmsTest1,代码行数:18,代码来源:HotsPresenter.java

示例15: requestLogout

import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; //导入依赖的package包/类
public void requestLogout(Activity activity) {
        mModel.logout()
                .subscribeOn(Schedulers.io())
                .retryWhen(new RetryWithDelay(3, 2))
                .subscribeOn(AndroidSchedulers.mainThread())
                .observeOn(AndroidSchedulers.mainThread())
                .compose(RxUtils.<BaseJson<String>>bindToLifecycle(mRootView))
                .subscribe(new ErrorHandleSubscriber<BaseJson<String>>(mErrorHandler) {
                               @Override
                               public void onNext(BaseJson<String> jsonObjectBaseJson) {
                                   if (jsonObjectBaseJson.getStatus() == 0) {
//                                       mRootView.showMessage(jsonObjectBaseJson.getMsgs());
                                       activity.finish();
                                   } else {
                                       mRootView.showMessage(jsonObjectBaseJson.getMsgs());
                                   }
                               }
                           }
                );
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:21,代码来源:UserPresenter.java


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