make sure copyRecursively works at moving paths in recycle bin
This commit is contained in:
parent
fa2eb4f7ed
commit
26d5fef4fd
2 changed files with 6 additions and 4 deletions
|
@ -47,7 +47,7 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:4.4.24'
|
implementation 'com.simplemobiletools:commons:4.4.27'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
|
|
|
@ -201,14 +201,16 @@ fun BaseSimpleActivity.tryDeleteFileDirItem(fileDirItem: FileDirItem, allowDelet
|
||||||
|
|
||||||
fun BaseSimpleActivity.movePathsInRecycleBin(paths: ArrayList<String>, callback: ((wasSuccess: Boolean) -> Unit)?) {
|
fun BaseSimpleActivity.movePathsInRecycleBin(paths: ArrayList<String>, callback: ((wasSuccess: Boolean) -> Unit)?) {
|
||||||
Thread {
|
Thread {
|
||||||
|
val mediumDao = galleryDB.MediumDao()
|
||||||
var pathsCnt = paths.size
|
var pathsCnt = paths.size
|
||||||
paths.forEach {
|
paths.forEach {
|
||||||
val file = File(it)
|
val file = File(it)
|
||||||
val internalFile = File(filesDir, it)
|
val internalFile = File(filesDir, it)
|
||||||
try {
|
try {
|
||||||
file.copyRecursively(internalFile, true)
|
if (file.copyRecursively(internalFile, true)) {
|
||||||
galleryDB.MediumDao().updateDeleted(it, System.currentTimeMillis())
|
mediumDao.updateDeleted(it, System.currentTimeMillis())
|
||||||
pathsCnt--
|
pathsCnt--
|
||||||
|
}
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue