use of com.tbruyelle.rxpermissions3.RxPermissions in project AndroidUtilLib by SiberiaDante.
the class SDDeviceUtilActivity method checkPermission1.
@SuppressLint("CheckResult")
private void checkPermission1() {
RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS).subscribe(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
SDLogUtil.d("--------------" + aBoolean);
if (aBoolean) {
showResult();
}
showResult();
}
});
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project PainlessMusicPlayer by Doctoror.
the class DeleteItemDialogFragment method onDeleteClick.
private void onDeleteClick() {
final Activity activity = getActivity();
new RxPermissions(activity).request(Manifest.permission.WRITE_EXTERNAL_STORAGE).subscribe(granted -> {
if (granted) {
performDelete();
}
});
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project ttdj by soonphe.
the class PublishGoodsFragment method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (parent.getId() == R.id.activity_postmessage_gridview) {
// 判断是否为最后一个
if (position == parent.getChildCount() - 1) {
new RxPermissions(getContext()).request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA).subscribe(granded -> {
if (granded) {
Matisse.from(this).choose(MimeType.ofAll(), false).countable(true).capture(// 拍照
true).captureStrategy(new CaptureStrategy(true, "com.connxun.ltcx.app.fileprovider")).maxSelectable(6).addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)).gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size)).restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED).thumbnailScale(0.85f).imageEngine(new GlideEngine()).forResult(REQUEST_CODE_CHOOSE);
} else {
ToastUtils.showShort("请先授予应用相关权限");
mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
// Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); //飞行模式,无线网和网络设置界面
// 跳转位置服务界面
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
});
}
});
}
}
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project ttdj by soonphe.
the class ApplyStoreActivity method onViewClicked.
@OnClick({ R.id.iv_image, R.id.tv_publish })
public void onViewClicked(View view) {
switch(view.getId()) {
case R.id.iv_image:
new RxPermissions(getContext()).request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA).subscribe(granded -> {
if (granded) {
Matisse.from(getContext()).choose(MimeType.ofAll(), false).countable(true).capture(// 拍照
true).captureStrategy(new CaptureStrategy(true, "com.connxun.ltcx.app.fileprovider")).maxSelectable(1).addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)).gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size)).restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED).thumbnailScale(0.85f).imageEngine(new GlideEngine()).forResult(REQUEST_CODE_CHOOSE);
} else {
ToastUtils.showShort("请先授予应用相关权限");
mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
// Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); //飞行模式,无线网和网络设置界面
// 跳转位置服务界面
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
});
}
});
break;
case R.id.tv_publish:
validator.validate();
break;
}
}
use of com.tbruyelle.rxpermissions3.RxPermissions in project ttdj by soonphe.
the class MainActivity method doBusiness.
@Override
public void doBusiness(Context mContext) {
if (Build.VERSION.SDK_INT >= 23) {
new RxPermissions(getContext()).request(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE).subscribe(granded -> {
if (granded) {
} else {
Toast("请先授予应用相关权限");
mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
// Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); //飞行模式,无线网和网络设置界面
// 跳转位置服务界面
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
});
}
});
}
Logger.addLogAdapter(new AndroidLogAdapter());
Logger.d("___________________hello");
// CrashReport.initCrashReport(getApplicationContext());
// CrashReport.testJavaCrash();
// DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(getApplicationContext(), "lenve.db", null);
// DaoMaster daoMaster = new DaoMaster(devOpenHelper.getWritableDb());
// DaoSession daoSession = daoMaster.newSession();
//
// VideoClassDao videoClassDao=daoSession.getVideoClassDao();
//
// VideoClass user = new VideoClass();
// videoClassDao.insert(user);
}
Aggregations