properly count how many files should be copied/moved at telling the result
This commit is contained in:
parent
4ee846921d
commit
4df35ca1d6
2 changed files with 6 additions and 3 deletions
|
@ -6,7 +6,7 @@ buildscript {
|
|||
propMinSdkVersion = 16
|
||||
propTargetSdkVersion = propCompileSdkVersion
|
||||
propVersionCode = 1
|
||||
propVersionName = '3.11.11'
|
||||
propVersionName = '3.11.12'
|
||||
kotlin_version = '1.2.21'
|
||||
support_libs = '27.0.2'
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal
|
|||
private var mListener: WeakReference<CopyMoveListener>? = null
|
||||
private var mMovedFiles: ArrayList<File> = ArrayList()
|
||||
private var mDocuments = LinkedHashMap<String, DocumentFile?>()
|
||||
lateinit var mFiles: ArrayList<File>
|
||||
private lateinit var mFiles: ArrayList<File>
|
||||
private var mFileCountToCopy = 0
|
||||
|
||||
// progress indication
|
||||
private var mNotificationManager: NotificationManager
|
||||
|
@ -54,6 +55,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal
|
|||
|
||||
val pair = params[0]
|
||||
mFiles = pair.first!!
|
||||
mFileCountToCopy = mFiles.size
|
||||
mNotifId = mFiles.hashCode()
|
||||
mMaxSize = 0
|
||||
for (file in mFiles) {
|
||||
|
@ -74,6 +76,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal
|
|||
if (newFile.exists()) {
|
||||
val resolution = getConflictResolution(newFile)
|
||||
if (resolution == CONFLICT_SKIP) {
|
||||
mFileCountToCopy--
|
||||
continue
|
||||
} else if (resolution == CONFLICT_OVERWRITE) {
|
||||
activity.deleteFilesBg(arrayListOf(newFile), true)
|
||||
|
@ -101,7 +104,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal
|
|||
val listener = mListener?.get() ?: return
|
||||
|
||||
if (success) {
|
||||
listener.copySucceeded(copyOnly, mMovedFiles.size >= mFiles.size)
|
||||
listener.copySucceeded(copyOnly, mMovedFiles.size >= mFileCountToCopy)
|
||||
} else {
|
||||
listener.copyFailed()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue