fix sharing files
This commit is contained in:
parent
3bacadac13
commit
48d0a1885e
1 changed files with 8 additions and 2 deletions
|
@ -156,9 +156,15 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
|
||||||
|
|
||||||
val shareTitle = activity.resources.getString(R.string.share_via)
|
val shareTitle = activity.resources.getString(R.string.share_via)
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = if (uris.size <= 1) Intent.ACTION_SEND else Intent.ACTION_SEND_MULTIPLE
|
if (uris.size <= 1) {
|
||||||
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
action = Intent.ACTION_SEND
|
||||||
|
putExtra(Intent.EXTRA_STREAM, uris.first())
|
||||||
|
} else {
|
||||||
|
action = Intent.ACTION_SEND_MULTIPLE
|
||||||
|
putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris)
|
||||||
|
}
|
||||||
type = getMimeType(uris)
|
type = getMimeType(uris)
|
||||||
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
activity.startActivity(Intent.createChooser(this, shareTitle))
|
activity.startActivity(Intent.createChooser(this, shareTitle))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue