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
app
build.gradle
src/main/kotlin/com/simplemobiletools/filemanager

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

@ -318,7 +318,7 @@ class MainActivity : SimpleActivity() {
fun pickedPaths(paths: ArrayList<String>) { fun pickedPaths(paths: ArrayList<String>) {
val newPaths = paths.map { getFilePublicUri(File(it), BuildConfig.APPLICATION_ID).toString() } as ArrayList 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 { newPaths.forEach {
clipData.addItem(ClipData.Item(it)) clipData.addItem(ClipData.Item(it))

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