make sure we call getLatestMediaId from a background thread

This commit is contained in:
tibbi 2017-12-17 20:53:17 +01:00
parent 67be9efbe3
commit 1c433b1ebf
2 changed files with 8 additions and 3 deletions

View file

@ -526,9 +526,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
private fun gotDirectories(newDirs: ArrayList<Directory>, isFromCache: Boolean) { private fun gotDirectories(newDirs: ArrayList<Directory>, isFromCache: Boolean) {
val dirs = getSortedDirectories(newDirs) Thread {
mLatestMediaId = getLatestMediaId() mLatestMediaId = getLatestMediaId()
}.start()
val dirs = getSortedDirectories(newDirs)
directories_refresh_layout.isRefreshing = false directories_refresh_layout.isRefreshing = false
mIsGettingDirs = false mIsGettingDirs = false

View file

@ -537,7 +537,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
} }
private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) { private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) {
Thread {
mLatestMediaId = getLatestMediaId() mLatestMediaId = getLatestMediaId()
}.start()
mIsGettingMedia = false mIsGettingMedia = false
media_refresh_layout.isRefreshing = false media_refresh_layout.isRefreshing = false