mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +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() {
|
private fun deleteDirectoryIfEmpty() {
|
||||||
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(this, true) == 0) {
|
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory) {
|
||||||
|
ensureBackgroundThread {
|
||||||
|
if (fileDirItem.getProperFileCount(this, true) == 0) {
|
||||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||||
scanPathRecursively(mDirectory)
|
scanPathRecursively(mDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SourceLockedOrientationActivity")
|
@SuppressLint("SourceLockedOrientationActivity")
|
||||||
private fun checkOrientation() {
|
private fun checkOrientation() {
|
||||||
|
|
|
@ -351,13 +351,17 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
showPortraitStripe()
|
showPortraitStripe()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensureBackgroundThread {
|
||||||
mImageOrientation = getImageOrientation()
|
mImageOrientation = getImageOrientation()
|
||||||
|
activity?.runOnUiThread {
|
||||||
when {
|
when {
|
||||||
mMedium.isGIF() -> loadGif()
|
mMedium.isGIF() -> loadGif()
|
||||||
mMedium.isSVG() -> loadSVG()
|
mMedium.isSVG() -> loadSVG()
|
||||||
else -> loadBitmap()
|
else -> loadBitmap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun loadGif() {
|
private fun loadGif() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue