当前位置: 首页>>代码示例>>Java>>正文


Java Permissive类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:19,代码来源:AlbumActivity.java

示例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);
  }
}
 
开发者ID:jksiezni,项目名称:permissive,代码行数:18,代码来源:MainActivity.java

示例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();
  }
}
 
开发者ID:jksiezni,项目名称:permissive,代码行数:11,代码来源:EducateUpFrontFragment.java

示例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);
}
 
开发者ID:jksiezni,项目名称:permissive,代码行数:8,代码来源:MainActivity.java

示例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);
}
 
开发者ID:jksiezni,项目名称:permissive,代码行数:9,代码来源:MainActivity.java


注:本文中的com.github.jksiezni.permissive.Permissive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。