本文整理汇总了Java中permissions.dispatcher.PermissionRequest类的典型用法代码示例。如果您正苦于以下问题:Java PermissionRequest类的具体用法?Java PermissionRequest怎么用?Java PermissionRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PermissionRequest类属于permissions.dispatcher包,在下文中一共展示了PermissionRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showRationaleForPermission
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
/**
* 向用户解释为什么需要这个权限的方法
**/
@OnShowRationale({Manifest.permission.CALL_PHONE, //拨号
Manifest.permission.PROCESS_OUTGOING_CALLS,
Manifest.permission.RECORD_AUDIO, //录音
Manifest.permission.ACCESS_COARSE_LOCATION, //定位
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_CONTACTS, //读取联系人
Manifest.permission.READ_CALL_LOG, //读取通话记录
Manifest.permission.READ_SMS, //读取短信
Manifest.permission.SEND_SMS, //发送短信
"android.permission.WRITE_SMS", //写短信
Manifest.permission.BLUETOOTH, //蓝牙
Manifest.permission.BLUETOOTH_ADMIN})
public void showRationaleForPermission(final PermissionRequest request) {
Log.i("LingJu", "StartUpActivity showRationaleForPermission()");
new CommonDialog(this, "申请权限", "应用还需要以下权限才能正常运行", "知道了")
.setOnConfirmListener(new CommonDialog.OnConfirmListener() {
@Override
public void onConfirm() {
request.proceed();
}
})
.show();
}
示例2: showWhy
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CALL_PHONE)
//提示用户为何要开启此权限
void showWhy(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setMessage("提示用户为何要开启此权限")
.setPositiveButton("知道了", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
request.proceed();//再次执行权限请求
}
})
.show();
}
示例3: showRationaleForPermissionState
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
/**
* 弹出权限同意窗口之前调用的提示窗口
*
* @param request
*/
@OnShowRationale({Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH,
Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
void showRationaleForPermissionState(PermissionRequest request) {
// NOTE: Show a rationale to explain why the permission is needed, e.g. with a dialog.
// Call proceed() or cancel() on the provided PermissionRequest to continue or abort
MyAlertDialog.showRationaleDialog(this, R.string.permission_rationale, request);
}
示例4: showWhy
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CAMERA)
//提示用户为何要开启此权限
void showWhy(final PermissionRequest request)
{
new AlertDialog.Builder(context).setMessage("添加设备需要摄像头扫描")
.setPositiveButton("知道了", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
request.proceed();
}
}).show();
}
示例5: showWhy
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)
//提示用户为何要开启此权限
void showWhy(final PermissionRequest request)
{
new AlertDialog.Builder(this).setMessage("下载新版apk需要读写文件权限")
.setPositiveButton("知道了", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
request.proceed();
}
}).show();
}
示例6: showRationaleForCamera
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.READ_PHONE_STATE)
void showRationaleForCamera(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setMessage("Need READ_PHONE_STATE permission for check with Telephony function")
.setPositiveButton("Allow", (dialog, button) -> request.proceed())
.setNegativeButton("Deny", (dialog, button) -> request.cancel())
.show();
}
示例7: showRationaleForRecord
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.RECORD_AUDIO)
void showRationaleForRecord(final PermissionRequest request) {
new CommonDialog.Builder().setContext(getActivity()).setContentStr(
getResources().getString(R.string.homefragment_permission_prompt))
.setOnDialogListener(new CommonDialog.OnDialogClickListener() {
@Override
public void doOk() {
request.proceed();
}
}).setIsShowOne(true).build().show();
}
示例8: showRationale
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CAMERA)
void showRationale(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setMessage("申请相机权限")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//再次执行请求
request.proceed();
}
})
.show();
}
示例9: showRationaleForPermissionState
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
/**
* 弹出权限同意窗口之前调用的提示窗口
* @param request
*/
@OnShowRationale({Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH,
Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
void showRationaleForPermissionState(PermissionRequest request) {
// NOTE: Show a rationale to explain why the permission is needed, e.g. with a dialog.
// Call proceed() or cancel() on the provided PermissionRequest to continue or abort
MyAlertDialog.showRationaleDialog(this, R.string.permission_rationale, request);
}
示例10: showRationale
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@OnShowRationale({Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
public void showRationale(PermissionRequest request) {
new AlertDialog.Builder(this)
.setMessage(R.string.permission_dialog_access_external_storage_title)
.setPositiveButton(R.string.permission_dialog_allow, (dialog, button) -> request.proceed())
.setNegativeButton(R.string.permission_dialog_deny, (dialog, button) -> request.cancel())
.show();
}
示例11: onShowRationale
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CAMERA)
void onShowRationale(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setPositiveButton(R.string.permission_go_request, new DialogInterface.OnClickListener() {
@Override
public void onClick(@NonNull DialogInterface dialog, int which) {
request.proceed();
}
})
.setCancelable(false)
.setTitle(R.string.permission_dialog_title)
.setMessage(R.string.permission_request_camera)
.show();
}
示例12: onShowRationale
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale({Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
void onShowRationale(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setPositiveButton(R.string.permission_go_request, new DialogInterface.OnClickListener() {
@Override
public void onClick(@NonNull DialogInterface dialog, int which) {
request.proceed();
}
})
.setCancelable(false)
.setTitle(R.string.permission_dialog_title)
.setMessage(R.string.permission_request_necessary)
.show();
}
示例13: onShowRationale
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)
void onShowRationale(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setPositiveButton(R.string.permission_go_request, new DialogInterface.OnClickListener() {
@Override
public void onClick(@NonNull DialogInterface dialog, int which) {
request.proceed();
}
})
.setCancelable(false)
.setTitle(R.string.permission_dialog_title)
.setMessage(R.string.permission_request_storage)
.show();
}
示例14: showRationaleDialog
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
private void showRationaleDialog(@StringRes int messageResId, final PermissionRequest request) {
new AlertDialog.Builder(getContext())
.setPositiveButton(R.string.map_button_allow, (dialog, which) -> {
request.proceed();
})
.setNegativeButton(R.string.map_button_deny, (dialog, which) -> {
request.cancel();
})
.setCancelable(false)
.setMessage(messageResId)
.show();
}
示例15: showRationaleForGetAccount
import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.GET_ACCOUNTS)
void showRationaleForGetAccount(final PermissionRequest request) {
new AlertDialog.Builder(this)
.setMessage(R.string.permission_get_account)
.setPositiveButton(R.string.button_allow, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
request.proceed();
}
})
.show();
}