removing the new copy/move related parameters
This commit is contained in:
parent
089d53679f
commit
dc3f102611
2 changed files with 12 additions and 23 deletions
|
@ -7,7 +7,7 @@ buildscript {
|
|||
propMinSdkVersion = 21
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '5.20.11'
|
||||
propVersionName = '5.20.12'
|
||||
kotlin_version = '1.3.61'
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import java.util.regex.Pattern
|
|||
abstract class BaseSimpleActivity : AppCompatActivity() {
|
||||
var copyMoveCallback: ((destinationPath: String) -> Unit)? = null
|
||||
var actionOnPermission: ((granted: Boolean) -> Unit)? = null
|
||||
var showCopyMoveToasts = true
|
||||
var isAskingPermissions = false
|
||||
var useDynamicTheme = true
|
||||
var checkedDocumentPath = ""
|
||||
|
@ -311,7 +310,7 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
fun copyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>, source: String, destination: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean,
|
||||
copyHidden: Boolean, showToasts: Boolean, forceCopyMoveTask: Boolean, callback: (destinationPath: String) -> Unit) {
|
||||
copyHidden: Boolean, callback: (destinationPath: String) -> Unit) {
|
||||
if (source == destination) {
|
||||
toast(R.string.source_and_destination_same)
|
||||
return
|
||||
|
@ -328,16 +327,15 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
|
|||
return@handleSAFDialog
|
||||
}
|
||||
|
||||
showCopyMoveToasts = showToasts
|
||||
copyMoveCallback = callback
|
||||
var fileCountToCopy = fileDirItems.size
|
||||
if (isCopyOperation || forceCopyMoveTask) {
|
||||
startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden, showToasts)
|
||||
if (isCopyOperation) {
|
||||
startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden)
|
||||
} else {
|
||||
if (isPathOnOTG(source) || isPathOnOTG(destination) || isPathOnSD(source) || isPathOnSD(destination) || fileDirItems.first().isDirectory) {
|
||||
handleSAFDialog(source) {
|
||||
if (it) {
|
||||
startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden, showToasts)
|
||||
startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -394,16 +392,12 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
|
|||
return newFile
|
||||
}
|
||||
|
||||
private fun startCopyMove(files: ArrayList<FileDirItem>, destinationPath: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean,
|
||||
showToasts: Boolean) {
|
||||
private fun startCopyMove(files: ArrayList<FileDirItem>, destinationPath: String, isCopyOperation: Boolean, copyPhotoVideoOnly: Boolean, copyHidden: Boolean) {
|
||||
val availableSpace = destinationPath.getAvailableStorageB()
|
||||
val sumToCopy = files.sumByLong { it.getProperSize(applicationContext, copyHidden) }
|
||||
if (availableSpace == -1L || sumToCopy < availableSpace) {
|
||||
checkConflicts(files, destinationPath, 0, LinkedHashMap()) {
|
||||
if (showToasts) {
|
||||
toast(if (isCopyOperation) R.string.copying else R.string.moving)
|
||||
}
|
||||
|
||||
toast(if (isCopyOperation) R.string.copying else R.string.moving)
|
||||
val pair = Pair(files, destinationPath)
|
||||
CopyMoveTask(this, isCopyOperation, copyPhotoVideoOnly, it, copyMoveListener, copyHidden).execute(pair)
|
||||
}
|
||||
|
@ -459,12 +453,10 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
|
|||
|
||||
val copyMoveListener = object : CopyMoveListener {
|
||||
override fun copySucceeded(copyOnly: Boolean, copiedAll: Boolean, destinationPath: String) {
|
||||
if (showCopyMoveToasts) {
|
||||
if (copyOnly) {
|
||||
toast(if (copiedAll) R.string.copying_success else R.string.copying_success_partial)
|
||||
} else {
|
||||
toast(if (copiedAll) R.string.moving_success else R.string.moving_success_partial)
|
||||
}
|
||||
if (copyOnly) {
|
||||
toast(if (copiedAll) R.string.copying_success else R.string.copying_success_partial)
|
||||
} else {
|
||||
toast(if (copiedAll) R.string.moving_success else R.string.moving_success_partial)
|
||||
}
|
||||
|
||||
copyMoveCallback?.invoke(destinationPath)
|
||||
|
@ -472,10 +464,7 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
override fun copyFailed() {
|
||||
if (showCopyMoveToasts) {
|
||||
toast(R.string.copy_move_failed)
|
||||
}
|
||||
|
||||
toast(R.string.copy_move_failed)
|
||||
copyMoveCallback = null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue