mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-24 15:56:07 +00:00
Ask for storage permissions before showing the dialog on import
This commit is contained in:
parent
04dbb71cd7
commit
9c0ce4210c
1 changed files with 7 additions and 5 deletions
|
@ -221,6 +221,10 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Pas
|
|||
}
|
||||
|
||||
private void onImport() {
|
||||
if (!PermissionHelper.request(getActivity(), CODE_PERM_IMPORT, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Class<? extends DatabaseImporter>> importers = DatabaseImporter.getImporters();
|
||||
String[] names = importers.keySet().toArray(new String[importers.size()]);
|
||||
|
||||
|
@ -232,12 +236,10 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Pas
|
|||
int i = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
|
||||
_importerType = importers.get(names[i]);
|
||||
|
||||
if (PermissionHelper.request(getActivity(), CODE_PERM_IMPORT, Manifest.permission.READ_EXTERNAL_STORAGE)) {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("*/*");
|
||||
startActivityForResult(intent, CODE_IMPORT);
|
||||
}
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue