Java Code Examples for com.github.angads25.filepicker.view.FilePickerDialog#EXTERNAL_READ_PERMISSION_GRANT

The following examples show how to use com.github.angads25.filepicker.view.FilePickerDialog#EXTERNAL_READ_PERMISSION_GRANT . 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: MainFrameActivity.java    From hipda with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String permissions[], @NonNull int[] grantResults) {
    switch (requestCode) {
        case PERMISSIONS_REQUEST_CODE_STORAGE: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                UIUtils.toast("授权成功");
            }
            break;
        }
        case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT: {
            if (grantResults.length == 0
                    || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
                UIUtils.askForStoragePermission(this);
            }
            break;
        }
    }
}
 
Example 2
Source File: StartMenuActivity.java    From VIA-AI with MIT License 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {

    switch (requestCode) {
        case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT: {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            }
            else {
                //Permission has not been granted. Notify the user.
                Toast.makeText(StartMenuActivity.this,"Permission is Required for getting list of files",Toast.LENGTH_SHORT).show();
            }
        }
    }
}