本文整理汇总了Java中com.github.jksiezni.permissive.Permissive类的典型用法代码示例。如果您正苦于以下问题:Java Permissive类的具体用法?Java Permissive怎么用?Java Permissive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Permissive类属于com.github.jksiezni.permissive包,在下文中一共展示了Permissive类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPermissionAndSetupAlbum
import com.github.jksiezni.permissive.Permissive; //导入依赖的package包/类
private void checkPermissionAndSetupAlbum(String... items) {
if(mRequest==null) {
mRequest = new Permissive.Request(permissionArray)
.withRationale((activity, allowablePermissions, messenger) -> {
})
.whenPermissionsGranted(permissions -> {
if (permissions.length == permissionArray.length) {
onSuccess();
}
})
.whenPermissionsRefused(permissions -> {
});
mRequest.execute(this);
}
}
示例2: onCreate
import com.github.jksiezni.permissive.Permissive; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(getClass().getSimpleName(), "onCreate(): " + savedInstanceState);
setContentView(R.layout.activity_main);
if (null == savedInstanceState) {
new Permissive.Request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.withRationale(new EducateUpFrontFragment())
.showRationaleFirst(true)
.execute(this);
} else {
new Permissive.Request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.showRationaleFirst(true)
.execute(this);
}
}
示例3: onResume
import com.github.jksiezni.permissive.Permissive; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
if (Permissive.filterPermissions(getContext(),
getPermissiveMessenger().getRequestedPermissions(),
PackageManager.PERMISSION_GRANTED).length > 0) {
// if user granted permission via Settings, then finish this fragment
finishFragment();
}
}
示例4: askForCameraPermission
import com.github.jksiezni.permissive.Permissive; //导入依赖的package包/类
public void askForCameraPermission(View view) {
new Permissive.Request(Manifest.permission.CAMERA)
.withRationale(new AskInContextFragment())
.whenPermissionsGranted(this::onPermissionsGranted)
.whenPermissionsRefused(this::onPermissionsRefused)
.execute(this);
}
示例5: educateForLocationPermission
import com.github.jksiezni.permissive.Permissive; //导入依赖的package包/类
public void educateForLocationPermission(View view) {
new Permissive.Request(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)
.showRationaleFirst(true)
.withRationale(new EducateInContextFragment())
.whenPermissionsGranted(this::onPermissionsGranted)
.whenPermissionsRefused(this::onPermissionsRefused)
.execute(this);
}