diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt index 8fc066b5..bacd3b03 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt @@ -25,7 +25,9 @@ import com.simplemobiletools.filemanager.R import com.simplemobiletools.filemanager.activities.SimpleActivity import com.simplemobiletools.filemanager.dialogs.CompressAsDialog import com.simplemobiletools.filemanager.extensions.config +import com.simplemobiletools.filemanager.extensions.isPathOnRoot import com.simplemobiletools.filemanager.extensions.isZipFile +import com.stericson.RootTools.RootTools import kotlinx.android.synthetic.main.list_item.view.* import java.io.Closeable import java.io.File @@ -207,11 +209,38 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList, destinationPath: String) { + activity.toast(R.string.copying) + Thread({ + var fileCnt = files.count() + files.forEach { + if (RootTools.copyFile(it.absolutePath, destinationPath, false, true)) { + fileCnt-- + } + } + + when { + fileCnt <= 0 -> activity.toast(R.string.copying_success) + fileCnt == files.count() -> activity.toast(R.string.copy_failed) + else -> activity.toast(R.string.copying_success_partial) + } + + activity.runOnUiThread { listener?.refreshItems() actMode?.finish() } - } + }).start() } private fun compressSelection() { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt index c16c7e05..28c2b83c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt @@ -75,6 +75,7 @@ class RootHelpers { super.commandCompleted(id, exitcode) } } + try { RootTools.getShell(true).add(command) } catch (e: Exception) {