moving folder deletion and image orientation fetching to background threads

This commit is contained in:
tibbi 2021-02-19 16:29:47 +01:00
parent 46d298596a
commit 4f79d196d6
2 changed files with 19 additions and 11 deletions

View file

@ -1164,11 +1164,15 @@ 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 && fileDirItem.getProperFileCount(this, true) == 0) {
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory) {
ensureBackgroundThread {
if (fileDirItem.getProperFileCount(this, true) == 0) {
tryDeleteFileDirItem(fileDirItem, true, true)
scanPathRecursively(mDirectory)
}
}
}
}
@SuppressLint("SourceLockedOrientationActivity")
private fun checkOrientation() {

View file

@ -351,13 +351,17 @@ class PhotoFragment : ViewPagerFragment() {
showPortraitStripe()
}
ensureBackgroundThread {
mImageOrientation = getImageOrientation()
activity?.runOnUiThread {
when {
mMedium.isGIF() -> loadGif()
mMedium.isSVG() -> loadSVG()
else -> loadBitmap()
}
}
}
}
private fun loadGif() {
try {