get the source path at copy/move from the first item

This commit is contained in:
tibbi 2017-04-01 18:08:49 +02:00
parent 8d1145e038
commit a963a13fc7
2 changed files with 8 additions and 3 deletions

View File

@ -18,8 +18,14 @@ open class SimpleActivity : BaseSimpleActivity() {
super.onCreate(savedInstanceState)
}
protected fun copyMoveFilesTo(source: String, files: ArrayList<File>, isCopyOperation: Boolean, callback: () -> Unit) {
fun copyMoveFilesTo(files: ArrayList<File>, isCopyOperation: Boolean, callback: () -> Unit) {
if (files.isEmpty()) {
toast(R.string.unknown_error_occurred)
return
}
copyMoveCallback = callback
val source = if (files[0].isFile) files[0].parent.trimEnd('/') else files[0].absolutePath
val currPath = source.trimEnd('/')
PickAlbumDialog(this, currPath) {
val destinationFolder = File(it)

View File

@ -185,9 +185,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
private fun copyMoveTo(isCopyOperation: Boolean) {
val currPath = File(getCurrentPath()).parent.trimEnd('/')
val files = ArrayList<File>(1).apply { add(getCurrentFile()) }
copyMoveFilesTo(currPath, files, isCopyOperation) {
copyMoveFilesTo(files, isCopyOperation) {
if (!isCopyOperation) {
reloadViewPager()
}