mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-27 06:57:59 +01:00
replacing some recursive path scans with direct path scans
This commit is contained in:
parent
4b839a0ac4
commit
8256580ec2
4 changed files with 5 additions and 7 deletions
|
@ -852,7 +852,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun scanFinalPath(path: String) {
|
private fun scanFinalPath(path: String) {
|
||||||
scanPathRecursively(path) {
|
rescanPaths(arrayListOf(path)) {
|
||||||
setResult(Activity.RESULT_OK, intent)
|
setResult(Activity.RESULT_OK, intent)
|
||||||
toast(R.string.file_saved)
|
toast(R.string.file_saved)
|
||||||
finish()
|
finish()
|
||||||
|
|
|
@ -108,7 +108,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
|
|
||||||
if (mUri!!.scheme == "file") {
|
if (mUri!!.scheme == "file") {
|
||||||
if (filename.contains('.')) {
|
if (filename.contains('.')) {
|
||||||
scanPathRecursively(mUri!!.path)
|
rescanPaths(arrayListOf(mUri!!.path))
|
||||||
sendViewPagerIntent(mUri!!.path)
|
sendViewPagerIntent(mUri!!.path)
|
||||||
finish()
|
finish()
|
||||||
return
|
return
|
||||||
|
@ -116,7 +116,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
} else {
|
} else {
|
||||||
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
||||||
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.') && File(path).exists()) {
|
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.') && File(path).exists()) {
|
||||||
scanPathRecursively(mUri!!.path)
|
rescanPaths(arrayListOf(mUri!!.path))
|
||||||
sendViewPagerIntent(path)
|
sendViewPagerIntent(path)
|
||||||
finish()
|
finish()
|
||||||
return
|
return
|
||||||
|
|
|
@ -1017,9 +1017,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
val fileDirItem = FileDirItem(mDirectory, mDirectory.getFilenameFromPath(), File(mDirectory).isDirectory)
|
val fileDirItem = FileDirItem(mDirectory, mDirectory.getFilenameFromPath(), File(mDirectory).isDirectory)
|
||||||
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory && fileDirItem.getProperFileCount(true) == 0) {
|
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory && fileDirItem.getProperFileCount(true) == 0) {
|
||||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||||
|
scanPathRecursively(mDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
scanPathRecursively(mDirectory)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkOrientation() {
|
private fun checkOrientation() {
|
||||||
|
|
|
@ -169,7 +169,6 @@ fun BaseSimpleActivity.removeNoMedia(path: String, callback: (() -> Unit)? = nul
|
||||||
}
|
}
|
||||||
|
|
||||||
tryDeleteFileDirItem(file.toFileDirItem(applicationContext), false, false) {
|
tryDeleteFileDirItem(file.toFileDirItem(applicationContext), false, false) {
|
||||||
scanPathRecursively(file.parent)
|
|
||||||
callback?.invoke()
|
callback?.invoke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,7 +436,7 @@ fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
copyFile(tmpPath, newPath)
|
copyFile(tmpPath, newPath)
|
||||||
scanPathRecursively(newPath)
|
rescanPaths(arrayListOf(newPath))
|
||||||
fileRotatedSuccessfully(newPath, oldLastModified)
|
fileRotatedSuccessfully(newPath, oldLastModified)
|
||||||
|
|
||||||
it.flush()
|
it.flush()
|
||||||
|
|
Loading…
Reference in a new issue