Use clip data to share multiple attachments

pull/212/head
M66B 2 years ago
parent ce045d4856
commit 4a8560b4ef

@ -6711,8 +6711,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (uris.size() == 1)
intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
else {
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
// Too many apps don't accept ACTION_SEND_MULTIPLE
ClipData clip = null;
ContentResolver resolver = context.getContentResolver();
for (Uri uri : uris) {
if (clip == null)
clip = ClipData.newUri(resolver, context.getString(R.string.app_name), uri);
else
clip.addItem(new ClipData.Item(uri));
}
intent.setClipData(clip);
}
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}

Loading…
Cancel
Save