moving some functions into background thread
This commit is contained in:
parent
8fc4fc2f88
commit
2cf4735767
|
@ -559,9 +559,15 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
}
|
||||
|
||||
private fun deleteDirectoryIfEmpty() {
|
||||
val fileDirItem = FileDirItem(mPath, mPath.getFilenameFromPath(), true)
|
||||
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory && fileDirItem.getProperFileCount(this, true) == 0) {
|
||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||
if (config.deleteEmptyFolders) {
|
||||
val fileDirItem = FileDirItem(mPath, mPath.getFilenameFromPath(), true)
|
||||
if (!fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory) {
|
||||
ensureBackgroundThread {
|
||||
if (fileDirItem.getProperFileCount(this, true) == 0) {
|
||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1163,12 +1163,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
private fun deleteDirectoryIfEmpty() {
|
||||
val fileDirItem = FileDirItem(mDirectory, mDirectory.getFilenameFromPath(), File(mDirectory).isDirectory)
|
||||
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory) {
|
||||
ensureBackgroundThread {
|
||||
if (fileDirItem.getProperFileCount(this, true) == 0) {
|
||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||
scanPathRecursively(mDirectory)
|
||||
if (config.deleteEmptyFolders) {
|
||||
val fileDirItem = FileDirItem(mDirectory, mDirectory.getFilenameFromPath(), File(mDirectory).isDirectory)
|
||||
if (!fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory) {
|
||||
ensureBackgroundThread {
|
||||
if (fileDirItem.getProperFileCount(this, true) == 0) {
|
||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||
scanPathRecursively(mDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,9 @@ fun BaseSimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
|
|||
} else {
|
||||
try {
|
||||
if (file.createNewFile()) {
|
||||
addNoMediaIntoMediaStore(file.absolutePath)
|
||||
ensureBackgroundThread {
|
||||
addNoMediaIntoMediaStore(file.absolutePath)
|
||||
}
|
||||
} else {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue