本文整理汇总了Java中me.jessyan.rxerrorhandler.core.RxErrorHandler类的典型用法代码示例。如果您正苦于以下问题:Java RxErrorHandler类的具体用法?Java RxErrorHandler怎么用?Java RxErrorHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RxErrorHandler类属于me.jessyan.rxerrorhandler.core包,在下文中一共展示了RxErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callPhone
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例2: externalStorage
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例3: sendSms
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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)
.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");
}
}
});
}
}
示例4: callPhone
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例5: readPhonestate
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例6: externalStorage
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例7: sendSms
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例8: externalStorage
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
/**
* 请求外部存储的权限
*/
public static void externalStorage(final RequestPermission requestPermission, RxPermissions rxPermissions, final IView 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");
}
}
});
}
}
示例9: callPhone
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
/**
* 请求打电话权限
*/
public static void callPhone(final RequestPermission requestPermission, RxPermissions rxPermissions, final IView 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");
}
}
});
}
}
示例10: externalStorage
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的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");
}
}
});
}
}
示例11: sendSms
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
/**
* 请求发送短信权限
*/
public static void sendSms(final RequestPermission requestPermission, RxPermissions rxPermissions, final IView view, RxErrorHandler errorHandler) {
//先确保是否已经申请过权限
boolean isPermissionsGranted =
rxPermissions
.isGranted(Manifest.permission.SEND_SMS);
if (isPermissionsGranted) {//已经申请过,直接执行操作
requestPermission.onRequestPermissionSuccess();
} else {//没有申请过,则申请
rxPermissions
.request(Manifest.permission.SEND_SMS)
.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");
}
}
});
}
}
示例12: launchCamera
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
/**
* 请求摄像头权限
*/
public static void launchCamera(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
//先确保是否已经申请过摄像头,和写入外部存储的权限
boolean isPermissionsGranted =
rxPermissions
.isGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE) &&
rxPermissions
.isGranted(Manifest.permission.CAMERA);
if (isPermissionsGranted) {//已经申请过,直接执行操作
requestPermission.onRequestPermissionSuccess();
} else {//没有申请过,则申请
rxPermissions
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE
, Manifest.permission.CAMERA)
.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");
}
}
});
}
}
示例13: proRxErrorHandler
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
/**
* 提供处理Rxjava错误的管理器
*
* @return
*/
@Singleton
@Provides
RxErrorHandler proRxErrorHandler(Application application, ResponseErroListener listener) {
return RxErrorHandler
.builder()
.with(application)
.responseErroListener(listener)
.build();
}
示例14: UserPresenter
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
@Inject
public UserPresenter(UserContract.Model model, UserContract.View rootView, RxErrorHandler handler
, AppManager appManager, Application application) {
super(model, rootView);
this.mApplication = application;
this.mErrorHandler = handler;
this.mAppManager = appManager;
mAdapter = new UserAdapter(mUsers);
mRootView.setAdapter(mAdapter);//设置Adapter
}
示例15: launchCamera
import me.jessyan.rxerrorhandler.core.RxErrorHandler; //导入依赖的package包/类
/**
* 请求摄像头权限
*/
public static void launchCamera(final RequestPermission requestPermission, RxPermissions rxPermissions, final BaseView view, RxErrorHandler errorHandler) {
//先确保是否已经申请过摄像头,和写入外部存储的权限
boolean isPermissionsGranted =
rxPermissions
.isGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE) &&
rxPermissions
.isGranted(Manifest.permission.CAMERA);
if (isPermissionsGranted) {//已经申请过,直接执行操作
requestPermission.onRequestPermissionSuccess();
} else {//没有申请过,则申请
rxPermissions
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE
, Manifest.permission.CAMERA)
.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");
}
}
});
}
}