mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
add the copy move dialog
This commit is contained in:
parent
9a0cde9796
commit
57a0baa253
1 changed files with 20 additions and 17 deletions
|
@ -180,24 +180,16 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyTo() {
|
private fun copyTo() {
|
||||||
val copyMoveListener = object : CopyMoveTask.CopyMoveListener {
|
copyMoveTo(true)
|
||||||
override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean) {
|
|
||||||
if (copyOnly) {
|
|
||||||
toast(if (copiedAll) R.string.copying_success else R.string.copying_success_partial)
|
|
||||||
} else {
|
|
||||||
reloadViewPager()
|
|
||||||
toast(if (copiedAll) R.string.moving_success else R.string.moving_success_partial)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun copyFailed() {
|
private fun moveTo() {
|
||||||
toast(R.string.copy_move_failed)
|
copyMoveTo(false)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun copyMoveTo(isCopyOperation: Boolean) {
|
||||||
val currPath = File(getCurrentPath()).parent.trimEnd('/')
|
val currPath = File(getCurrentPath()).parent.trimEnd('/')
|
||||||
val files = ArrayList<File>(1).apply { add(getCurrentFile()) }
|
val files = ArrayList<File>(1).apply { add(getCurrentFile()) }
|
||||||
val isCopyOperation = true
|
|
||||||
|
|
||||||
PickAlbumDialog(this, currPath) {
|
PickAlbumDialog(this, currPath) {
|
||||||
val destinationFolder = File(it)
|
val destinationFolder = File(it)
|
||||||
|
@ -222,13 +214,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
if (isCopyOperation) {
|
if (isCopyOperation) {
|
||||||
toast(R.string.copying)
|
toast(R.string.copying)
|
||||||
val pair = Pair<ArrayList<File>, File>(files, destinationFolder)
|
val pair = Pair<ArrayList<File>, File>(files, destinationFolder)
|
||||||
CopyMoveTask(this, false, true, copyMoveListener).execute(pair)
|
CopyMoveTask(this, isCopyOperation, true, copyMoveListener).execute(pair)
|
||||||
} else {
|
} else {
|
||||||
if (isPathOnSD(currPath) || isPathOnSD(destinationFolder.absolutePath)) {
|
if (isPathOnSD(currPath) || isPathOnSD(destinationFolder.absolutePath)) {
|
||||||
handleSAFDialog(files[0]) {
|
handleSAFDialog(files[0]) {
|
||||||
toast(R.string.moving)
|
toast(R.string.moving)
|
||||||
val pair = Pair<ArrayList<File>, File>(files, destinationFolder)
|
val pair = Pair<ArrayList<File>, File>(files, destinationFolder)
|
||||||
CopyMoveTask(this, true, true, copyMoveListener).execute(pair)
|
CopyMoveTask(this, isCopyOperation, true, copyMoveListener).execute(pair)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val updatedFiles = ArrayList<File>(files.size * 2)
|
val updatedFiles = ArrayList<File>(files.size * 2)
|
||||||
|
@ -250,8 +242,19 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun moveTo() {
|
private val copyMoveListener = object : CopyMoveTask.CopyMoveListener {
|
||||||
|
override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean) {
|
||||||
|
if (copyOnly) {
|
||||||
|
toast(if (copiedAll) R.string.copying_success else R.string.copying_success_partial)
|
||||||
|
} else {
|
||||||
|
reloadViewPager()
|
||||||
|
toast(if (copiedAll) R.string.moving_success else R.string.moving_success_partial)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun copyFailed() {
|
||||||
|
toast(R.string.copy_move_failed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveImageAs() {
|
private fun saveImageAs() {
|
||||||
|
|
Loading…
Reference in a new issue