本文整理汇总了Java中com.hujiang.permissiondispatcher.PermissionItem.needGotoSetting方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionItem.needGotoSetting方法的具体用法?Java PermissionItem.needGotoSetting怎么用?Java PermissionItem.needGotoSetting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hujiang.permissiondispatcher.PermissionItem
的用法示例。
在下文中一共展示了PermissionItem.needGotoSetting方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processCheckPermissionOnActivity
import com.hujiang.permissiondispatcher.PermissionItem; //导入方法依赖的package包/类
private static void processCheckPermissionOnActivity(final Activity target, String[] permissions, String rationalMessage, String rationalButton
, String deniedMessage, String deniedButton, String settingText, boolean needGotoSetting, final boolean runIgnorePermission) {
Assert.assertTrue(permissions != null && permissions.length > 0);
PermissionItem permissionItem = new PermissionItem(permissions);
if (!TextUtils.isEmpty(rationalMessage)
&& !TextUtils.isEmpty(rationalButton)) {
permissionItem.rationalMessage(rationalMessage).rationalButton(rationalButton);
}
if (!TextUtils.isEmpty(deniedMessage)
&& !TextUtils.isEmpty(deniedButton)) {
permissionItem.deniedMessage(deniedMessage).deniedButton(deniedButton);
}
if (!TextUtils.isEmpty(settingText)) {
permissionItem.settingText(settingText);
}
permissionItem.needGotoSetting(needGotoSetting);
CheckPermission.instance(target).check(permissionItem, new PermissionListener() {
@Override
public void permissionGranted() {
sActivitySessions.remove(target.getClass().getName());
}
@Override
public void permissionDenied() {
sActivitySessions.remove(target.getClass().getName());
if (!runIgnorePermission) {
target.finish();
}
}
});
}
示例2: adviceOnNeedPermissionMethod
import com.hujiang.permissiondispatcher.PermissionItem; //导入方法依赖的package包/类
@Around("pointcutOnNeedPermissionMethod(needPermission)")
public void adviceOnNeedPermissionMethod(final ProceedingJoinPoint joinPoint, final NeedPermission needPermission) throws Throwable {
try {
if (needPermission == null) {
joinPoint.proceed();
return;
}
if (needPermission.runIgnorePermission()) {
joinPoint.proceed();
}
String[] permissions = needPermission.permissions();
if (permissions != null && permissions.length > 0) {
Context context = PermissionCheckSDK.application;
PermissionItem permissionItem = new PermissionItem(permissions);
String rationalMsg = chooseContent(context, needPermission.rationalMessage(), needPermission.rationalMsgResId());
String rationalBtn = chooseContent(context, needPermission.rationalButton(), needPermission.rationalBtnResId());
String deniedMsg = chooseContent(context, needPermission.deniedMessage(), needPermission.deniedMsgResId());
String deniedBtn = chooseContent(context, needPermission.deniedButton(), needPermission.deniedBtnResId());
String settingBtn = chooseContent(context, needPermission.settingText(), needPermission.settingResId());
if (!TextUtils.isEmpty(rationalMsg)
&& !TextUtils.isEmpty(rationalBtn)) {
permissionItem.rationalMessage(rationalMsg).rationalButton(rationalBtn);
}
if (!TextUtils.isEmpty(deniedMsg)
&& !TextUtils.isEmpty(deniedBtn)) {
permissionItem.deniedMessage(deniedMsg).deniedButton(deniedBtn);
}
if (!TextUtils.isEmpty(settingBtn)) {
permissionItem.settingText(settingBtn);
}
permissionItem.needGotoSetting(needPermission.needGotoSetting());
CheckPermission.instance(context).check(permissionItem, new PermissionListener() {
@Override
public void permissionGranted() {
if (!needPermission.runIgnorePermission()) {
try {
joinPoint.proceed();
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}
@Override
public void permissionDenied() {
}
});
}
} catch (NoSuchMethodException e) {
joinPoint.proceed();
}
}