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