adding a couple changes related to handling GET_CONTENT intent with multiple files

This commit is contained in:
tibbi 2018-10-23 16:03:00 +02:00
parent 27aafbab6e
commit e9afd1c41b
3 changed files with 8 additions and 4 deletions

View File

@ -42,7 +42,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.0.18'
implementation 'com.simplemobiletools:commons:5.2.1'
implementation files('../libs/RootTools.jar')
}

View File

@ -318,7 +318,7 @@ class MainActivity : SimpleActivity() {
fun pickedPaths(paths: ArrayList<String>) {
val newPaths = paths.map { getFilePublicUri(File(it), BuildConfig.APPLICATION_ID).toString() } as ArrayList
val clipData = ClipData("Attachment", arrayOf(newPaths.getMimeType()), ClipData.Item(newPaths.removeAt(0)))
val clipData = ClipData("Attachment", arrayOf(paths.getMimeType()), ClipData.Item(newPaths.removeAt(0)))
newPaths.forEach {
clipData.addItem(ClipData.Item(it))

View File

@ -143,8 +143,12 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
private fun confirmSelection() {
if (selectedKeys.isNotEmpty()) {
val paths = getSelectedFileDirItems().filter { !it.isDirectory }.map { it.path } as ArrayList<String>
listener?.selectedPaths(paths)
val paths = getSelectedFileDirItems().asSequence().filter { !it.isDirectory }.map { it.path }.toMutableList() as ArrayList<String>
if (paths.isEmpty()) {
finishActMode()
} else {
listener?.selectedPaths(paths)
}
}
}