mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
moving folder deletion and image orientation fetching to background threads
This commit is contained in:
parent
46d298596a
commit
4f79d196d6
2 changed files with 19 additions and 11 deletions
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue