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