Java Code Examples for pub.devrel.easypermissions.EasyPermissions#somePermissionPermanentlyDenied()

The following examples show how to use pub.devrel.easypermissions.EasyPermissions#somePermissionPermanentlyDenied() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuideActivity.java    From YCAudioPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * 某些权限已被拒绝
 */
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    //某些权限已被拒绝
    Log.d("权限", "onPermissionsDenied:" + requestCode + ":" + perms.size());
    // (Optional) Check whether the user denied any permissions and checked "NEVER ASK AGAIN."
    // This will display a dialog directing them to enable the permission in app settings.
    if (EasyPermissions.somePermissionPermanentlyDenied(GuideActivity.this, perms)) {
        AppSettingsDialog.Builder builder = new AppSettingsDialog.Builder(GuideActivity.this);
        builder.setTitle("允许权限")
                .setRationale("没有该权限,此应用程序部分功能可能无法正常工作。打开应用设置界面以修改应用权限")
                .setPositiveButton("去设置")
                .setNegativeButton("取消")
                .setRequestCode(RC_LOCATION_CONTACTS_PERM)
                .build()
                .show();
    }else {
        ToastUtils.showShort("没有存储空间权限,无法扫描本地歌曲!");
        finish();
    }
}
 
Example 2
Source File: BaseActivity.java    From VideoAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if(mPermissonCallbacks == null || !mPermissonCallbacks.containsKey(requestCode)) {
        return;
    }
    if(mPermissions == null || !mPermissions.containsKey(requestCode)) {
        return;
    }

    //granted permission
    List<String> grantedPerms = new ArrayList<>();
    for(String perm : mPermissions.get(requestCode)) {
        if(!perms.contains(perm)) {
            grantedPerms.add(perm);
        }
    }

    //check has permission denied permanently
    if(EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        mPermissonCallbacks.get(requestCode).noPermission(perms, grantedPerms, true);
    } else {
        mPermissonCallbacks.get(requestCode).noPermission(perms, grantedPerms, false);
    }
}
 
Example 3
Source File: ImageActivity.java    From FirebaseUI-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
    if (EasyPermissions.somePermissionPermanentlyDenied(this,
                                                        Collections.singletonList(PERMS))) {
        new AppSettingsDialog.Builder(this).build().show();
    }
}
 
Example 4
Source File: ServerDetailsActivity.java    From droidovpn with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        new AppSettingsDialog.Builder(this).build().show();
    } else {
        Snackbar.make(rootView, R.string.permission_denied_message,
                Snackbar.LENGTH_SHORT).show();
    }
}
 
Example 5
Source File: ReactChatInputManager.java    From aurora-imui with MIT License 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if (mContext.getCurrentActivity() != null) {
        if (EasyPermissions.somePermissionPermanentlyDenied(mContext.getCurrentActivity(), perms)) {
            new AppSettingsDialog.Builder(mContext.getCurrentActivity()).build().show();
        }
    }

}
 
Example 6
Source File: MainActivity.java    From easypermissions with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
    Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size());

    // (Optional) Check whether the user denied any permissions and checked "NEVER ASK AGAIN."
    // This will display a dialog directing them to enable the permission in app settings.
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        new AppSettingsDialog.Builder(this).build().show();
    }
}
 
Example 7
Source File: MainActivity.java    From SocialSDKAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        Toast.makeText(getApplicationContext(), "前往设置开启访问存储空间权限", Toast.LENGTH_SHORT).show();
        finish();
    }
}
 
Example 8
Source File: MainActivity.java    From AndroidApp with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if (requestCode == WRITE_EXTERNAL_STORAGE_PERMISSION) {
        new AppToast(this).longToast(R.string.write_storage_request_toast);

        //double check that write access is granted, this permission is needed
        requestWriteExternalStoragePermission();
        // (Optional) Check whether the user denied any permissions and checked "NEVER ASK AGAIN."
        // This will display a dialog directing them to enable the permission in app settings.
        if (!EasyPermissions.hasPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE))
            if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
                new AppSettingsDialog.Builder(this).build().show();
            }
    } else if (requestCode == LOCATION_PERMISSION) {
        new AppToast(this).longToast(R.string.location_request_toast);

        //double check that write access is granted, this permission is needed
        requestLocationPermission();
        String[] permissions = {Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION};
        // (Optional) Check whether the user denied any permissions and checked "NEVER ASK AGAIN."
        // This will display a dialog directing them to enable the permission in app settings.
        if (!EasyPermissions.hasPermissions(this, permissions))
            if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
                new AppSettingsDialog.Builder(this).build().show();
            }
    }
}
 
Example 9
Source File: ImagesFragment.java    From android-storage-permissions with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> list) {
    if (requestCode != REQUEST_STORAGE_PERMISSION) {
        return;
    }

    if (EasyPermissions.somePermissionPermanentlyDenied(this, list)) {
        // Permanently denied. Notify presenter.
        Log.d(TAG, "Permission has been permanently denied.");
        new AppSettingsDialog.Builder(this).build().show();
    } else {
        mPresenter.onPermissionRequestResult(false);
    }

}
 
Example 10
Source File: ImageImportActivity.java    From android-storage-permissions with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> list) {
    if (requestCode != REQUEST_STORAGE_PERMISSION || !list.contains(READ_EXTERNAL_STORAGE)) {
        return;
    }

    if (EasyPermissions.somePermissionPermanentlyDenied(this, list)) {
        // Permanently denied. Notify presenter.
        Log.d(TAG, "Permission has been permanently denied.");
        new AppSettingsDialog.Builder(this).build().show();
    } else {
        showPermissionError(true);
    }

}
 
Example 11
Source File: MainActivity.java    From Android-AudioRecorder-App with Apache License 2.0 5 votes vote down vote up
@Override public void onPermissionsDenied(int requestCode, List<String> perms) {
  if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
    showRationale();
    return;
  }
  finish();
}
 
Example 12
Source File: AppDetailsFragment.java    From android-permission-checker-app with Apache License 2.0 5 votes vote down vote up
@Override public void onPermissionsDenied(int requestCode, List<String> perms) {
  if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
    showRationale();
    return;
  }
  appDetailsPresenter.onPermissionDenied();
}
 
Example 13
Source File: FeedManageActivity.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
    //3.2 申请失败
    // 用户因为之前点了不再显示权限申请提示导致的申请失败,显示一个引导去设置界面的对话框
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        new AppSettingsDialog.Builder(this).build().show();
    }else {//用户拒绝的申请,显示通知
        Toasty.error(FeedManageActivity.this,"请允许读存储器的权限,这样才能导入文件哦!").show();
    }
}
 
Example 14
Source File: MainActivity.java    From CombineBitmap with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if (1000 == requestCode) {
        if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
            new AppSettingsDialog.Builder(this)
                    .setTitle("tip")
                    .setRationale("need storage permission")
                    .build()
                    .show();
        }
    }
}
 
Example 15
Source File: AboutActivity.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    Log.i(MY_TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size());
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        //打开系统设置,手动授权
        Toast.makeText(this, SystemConstant.PERMISSION_SETTINGS_TIP
        , Toast.LENGTH_SHORT).show();
        new AppSettingsDialog.Builder(this).build().show();
    }
}
 
Example 16
Source File: FeedManageActivity.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
    //3.2 申请失败
    // 用户因为之前点了不再显示权限申请提示导致的申请失败,显示一个引导去设置界面的对话框
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        new AppSettingsDialog.Builder(this).build().show();
    }else {//用户拒绝的申请,显示通知
        Toasty.error(FeedManageActivity.this,"请允许读存储器的权限,这样才能导入文件哦!").show();
    }
}
 
Example 17
Source File: MainActivity.java    From blinkreceipt-android with MIT License 4 votes vote down vote up
@Override
public void onPermissionsDenied( int requestCode, @NonNull List<String> permissions ) {
    if ( EasyPermissions.somePermissionPermanentlyDenied( this, permissions ) ) {
        new AppSettingsDialog.Builder( this ).build().show();
    }
}
 
Example 18
Source File: MainActivity.java    From blinkreceipt-android with MIT License 4 votes vote down vote up
@Override
public void onPermissionsDenied( int requestCode, @NonNull List<String> permissions ) {
    if ( EasyPermissions.somePermissionPermanentlyDenied( this, permissions ) ) {
        new AppSettingsDialog.Builder( this ).build().show();
    }
}
 
Example 19
Source File: SplashActivity.java    From ViewCapture with Apache License 2.0 4 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        new AppSettingsDialog.Builder(this).build().show();
    }
}
 
Example 20
Source File: MessageListActivity.java    From aurora-imui with MIT License 4 votes vote down vote up
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
    if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
        new AppSettingsDialog.Builder(this).build().show();
    }
}