Skip to content

Commit

Permalink
fix issue miguelpruivo#1300: support pick multi-images
Browse files Browse the repository at this point in the history
  • Loading branch information
weibili committed Jun 9, 2023
1 parent a8346ee commit b9a3e2a
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,22 @@ private void startFileExplorer() {
if (type.equals("dir")) {
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
} else {
intent = new Intent();
if (type.equals("image/*")) {
intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
if (this.isMultipleSelection) {
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
} else {
intent.setAction(Intent.ACTION_PICK);
}
intent.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
} else {
intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
final Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + File.separator);
intent.setData(uri);
}
final Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + File.separator);
Log.d(TAG, "Selected type " + type);
intent.setDataAndType(uri, this.type);
intent.setType(this.type);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, this.isMultipleSelection);
intent.putExtra("multi-pick", this.isMultipleSelection);
Expand Down

0 comments on commit b9a3e2a

Please sign in to comment.