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,9 +1164,13 @@ 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) {
|
||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||
scanPathRecursively(mDirectory)
|
||||
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory) {
|
||||
ensureBackgroundThread {
|
||||
if (fileDirItem.getProperFileCount(this, true) == 0) {
|
||||
tryDeleteFileDirItem(fileDirItem, true, true)
|
||||
scanPathRecursively(mDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -351,11 +351,15 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
showPortraitStripe()
|
||||
}
|
||||
|
||||
mImageOrientation = getImageOrientation()
|
||||
when {
|
||||
mMedium.isGIF() -> loadGif()
|
||||
mMedium.isSVG() -> loadSVG()
|
||||
else -> loadBitmap()
|
||||
ensureBackgroundThread {
|
||||
mImageOrientation = getImageOrientation()
|
||||
activity?.runOnUiThread {
|
||||
when {
|
||||
mMedium.isGIF() -> loadGif()
|
||||
mMedium.isSVG() -> loadSVG()
|
||||
else -> loadBitmap()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,9 +691,9 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
val inputStream = if (mMedium.path.startsWith("content:/")) context!!.contentResolver.openInputStream(Uri.parse(mMedium.path)) else File(mMedium.path).inputStream()
|
||||
val imageParser = JpegImageParser().getXmpXml(ByteSourceInputStream(inputStream, mMedium.name), HashMap<String, Any>())
|
||||
imageParser.contains("GPano:UsePanoramaViewer=\"True\"", true) ||
|
||||
imageParser.contains("<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>", true) ||
|
||||
imageParser.contains("GPano:FullPanoWidthPixels=") ||
|
||||
imageParser.contains("GPano:ProjectionType>Equirectangular")
|
||||
imageParser.contains("<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>", true) ||
|
||||
imageParser.contains("GPano:FullPanoWidthPixels=") ||
|
||||
imageParser.contains("GPano:ProjectionType>Equirectangular")
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
} catch (e: OutOfMemoryError) {
|
||||
|
|
Loading…
Reference in a new issue