make sure gotDirectories is called on a background thread

This commit is contained in:
tibbi 2018-07-01 20:19:28 +02:00
parent d78eff3cee
commit 0316a21e39

View file

@ -337,7 +337,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
if (config.directorySorting and SORT_BY_DATE_MODIFIED > 0 || config.directorySorting and SORT_BY_DATE_TAKEN > 0) {
getDirectories()
} else {
Thread {
gotDirectories(getCurrentlyDisplayedDirs())
}.start()
}
}
}
@ -516,7 +518,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
CreateNewFolderDialog(this, it) {
config.tempFolderPath = it
Thread {
gotDirectories(addTempFolderIfNeeded(getCurrentlyDisplayedDirs()))
}.start()
}
}
}
@ -673,7 +677,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
// cached folders have been loaded, recheck folders one by one starting with the first displayed
Thread {
val mediaFetcher = MediaFetcher(applicationContext)
val getImagesOnly = mIsPickImageIntent || mIsGetImageContentIntent
val getVideosOnly = mIsPickVideoIntent || mIsGetVideoContentIntent
@ -772,7 +775,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
checkPlaceholderVisibility(dirs)
}
checkInvalidDirectories(dirs, directoryDao)
}.start()
}
private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) {
@ -956,7 +958,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
override fun recheckPinnedFolders() {
Thread {
gotDirectories(movePinnedDirectoriesToFront(getCurrentlyDisplayedDirs()))
}.start()
}
override fun updateDirectories(directories: ArrayList<Directory>) {