replacing some recursive path scans with direct path scans

This commit is contained in:
tibbi 2019-05-28 21:44:27 +02:00
parent 4b839a0ac4
commit 8256580ec2
4 changed files with 5 additions and 7 deletions

View file

@ -852,7 +852,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
}
private fun scanFinalPath(path: String) {
scanPathRecursively(path) {
rescanPaths(arrayListOf(path)) {
setResult(Activity.RESULT_OK, intent)
toast(R.string.file_saved)
finish()

View file

@ -108,7 +108,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
if (mUri!!.scheme == "file") {
if (filename.contains('.')) {
scanPathRecursively(mUri!!.path)
rescanPaths(arrayListOf(mUri!!.path))
sendViewPagerIntent(mUri!!.path)
finish()
return
@ -116,7 +116,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
} else {
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.') && File(path).exists()) {
scanPathRecursively(mUri!!.path)
rescanPaths(arrayListOf(mUri!!.path))
sendViewPagerIntent(path)
finish()
return

View file

@ -1017,10 +1017,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val fileDirItem = FileDirItem(mDirectory, mDirectory.getFilenameFromPath(), File(mDirectory).isDirectory)
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory && fileDirItem.getProperFileCount(true) == 0) {
tryDeleteFileDirItem(fileDirItem, true, true)
}
scanPathRecursively(mDirectory)
}
}
private fun checkOrientation() {
if (!mIsOrientationLocked && config.screenRotation == ROTATE_BY_ASPECT_RATIO) {

View file

@ -169,7 +169,6 @@ fun BaseSimpleActivity.removeNoMedia(path: String, callback: (() -> Unit)? = nul
}
tryDeleteFileDirItem(file.toFileDirItem(applicationContext), false, false) {
scanPathRecursively(file.parent)
callback?.invoke()
}
}
@ -437,7 +436,7 @@ fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String,
}
copyFile(tmpPath, newPath)
scanPathRecursively(newPath)
rescanPaths(arrayListOf(newPath))
fileRotatedSuccessfully(newPath, oldLastModified)
it.flush()