use of com.tbruyelle.rxpermissions3.RxPermissions in project DevRing by LJYcoder.
the class PermissionManager method requestEachCombined.
// 请求多个权限建议用这个
public void requestEachCombined(Activity activity, final PermissionListener listener, String... permissions) {
if (activity != null) {
RxPermissions rxPermissions = new RxPermissions(activity);
rxPermissions.requestEachCombined(permissions).subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) throws Exception {
if (permission.granted) {
// All permissions are granted !
if (listener != null) {
listener.onGranted(permission.name);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// At least one denied permission without ask never again
if (listener != null) {
listener.onDenied(permission.name);
}
} else {
// Need to go to the settings
if (listener != null) {
listener.onDeniedWithNeverAsk(permission.name);
}
}
}
});
}
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project DevRing by LJYcoder.
the class PermissionManager method requestEach.
// 请求单个权限建议用这个
public void requestEach(Activity activity, final PermissionListener listener, String... permissions) {
if (activity != null) {
RxPermissions rxPermissions = new RxPermissions(activity);
rxPermissions.requestEach(permissions).subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) throws Exception {
if (permission.granted) {
// `permission.name` is granted !
if (listener != null) {
listener.onGranted(permission.name);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// Denied permission without ask never again
if (listener != null) {
listener.onDenied(permission.name);
}
} else {
// Need to go to the settings
if (listener != null) {
listener.onDeniedWithNeverAsk(permission.name);
}
}
}
});
}
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project DevRing by LJYcoder.
the class PermissionManager method requestEachCombined.
// 请求多个权限建议用这个
public void requestEachCombined(FragmentActivity activity, final PermissionListener listener, String... permissions) {
if (activity != null) {
RxPermissions rxPermissions = new RxPermissions(activity);
rxPermissions.requestEachCombined(permissions).subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) throws Exception {
if (permission.granted) {
// All permissions are granted !
if (listener != null) {
listener.onGranted(permission.name);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// At least one denied permission without ask never again
if (listener != null) {
listener.onDenied(permission.name);
}
} else {
// Need to go to the settings
if (listener != null) {
listener.onDeniedWithNeverAsk(permission.name);
}
}
}
});
}
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project CustomViews by AndroidStudy233.
the class LoginActivity method initView.
@SuppressLint("CheckResult")
@Override
public void initView() {
rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.READ_PHONE_STATE).subscribe(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
if (aBoolean) {
Imei = CommonUtils.getImeiOrMeid(LoginActivity.this);
}
}
});
btnLogin = findViewById(R.id.btn_enter);
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project CustomViews by AndroidStudy233.
the class BaseActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.savedInstanceState = savedInstanceState;
// transparentNavigationBar();
try {
rxPermissions = new RxPermissions(this);
AppManagerUtil.getAppManager().addActivity(this);
setContentView(layoutId());
// ButterKnife.bind(this);
initToolbar();
baseBundle = getIntent().getBundleExtra("bundle");
initView();
BindEvent();
dialogProgress = new DialogProgress(this, R.style.DialogTheme);
inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
} catch (Exception e) {
e.printStackTrace();
}
loadProcess = new DialogProgress(this, R.style.DialogTheme);
}
Aggregations