diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index ddb92198c..d66248274 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -48,6 +48,7 @@ fun Activity.shareMedium(medium: Medium) { val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) val uri = Uri.fromFile(file) + Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_STREAM, uri) @@ -59,14 +60,12 @@ fun Activity.shareMedium(medium: Medium) { fun Activity.shareMedia(media: List) { val shareTitle = resources.getString(R.string.share_via) - val uris = ArrayList(media.size) + val uris = media.map { Uri.fromFile(File(it.path)) } as ArrayList + Intent().apply { action = Intent.ACTION_SEND_MULTIPLE type = "image/* video/*" addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - media.map { File(it.path) } - .mapTo(uris) { Uri.fromFile(it) } - putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) startActivity(Intent.createChooser(this, shareTitle)) }