mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-19 21:40:37 +01:00
moving folder deletion and image orientation fetching to background threads
This commit is contained in:
parent
46d298596a
commit
4f79d196d6
@ -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…
x
Reference in New Issue
Block a user