Skip to content

Commit 92ee8f4

Browse files
committed
use open document intent directly
file manager used via chooser is broken on Xiaomi and going via chooser is not necessary anyway
1 parent 034b8c8 commit 92ee8f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/itkach/aard2/DictionariesFragment.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ private void selectDictionaryFiles() {
102102
intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
103103
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
104104
intent.setType("*/*");
105-
Intent chooser = Intent.createChooser(intent, getResources().getString(R.string.title_activity_file_select));
105+
intent.addCategory(Intent.CATEGORY_OPENABLE);
106+
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
106107
try {
107-
startActivityForResult(chooser, FILE_SELECT_REQUEST);
108+
startActivityForResult(intent, FILE_SELECT_REQUEST);
108109
}
109110
catch (ActivityNotFoundException e){
110111
Log.d(TAG, "Not activity to get content", e);

0 commit comments

Comments
 (0)