Only Snackbar pops up on denying the permissions #979

Updated
This commit is contained in:
Vab 2019-02-13 17:06:04 +05:30 committed by Isaac Hutt
parent 9b41cda69d
commit 04b6d07b2b

View File

@ -1931,21 +1931,12 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
}
private void searchFiles() {
if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.READ_EXTERNAL_STORAGE)) {
Toast.makeText(this, R.string.request_storage,
Toast.LENGTH_LONG).show();
}
ActivityCompat.requestPermissions(this,
new String[] { Manifest.permission.READ_EXTERNAL_STORAGE },
REQUEST_READ_STORAGE_PERMISSION);
} else {
fileSearch.scan(sharedPreferenceUtil.getPrefStorage());
}
if (Build.VERSION.SDK_INT >= VERSION_CODES.M && ContextCompat.checkSelfPermission(this,
Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[] { Manifest.permission.READ_EXTERNAL_STORAGE },
REQUEST_READ_STORAGE_PERMISSION);
} else {
fileSearch.scan(sharedPreferenceUtil.getPrefStorage());
}