diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index d67254920..2dc2b02c7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -160,13 +160,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsGettingDirs = true val token = object : TypeToken>() {}.type val dirs = Gson().fromJson>(config.directories, token) ?: ArrayList(1) - if (dirs.size == 0) { - directories_refresh_layout.isRefreshing = true - } else if (!mLoadedInitialPhotos) { - mLoadedInitialPhotos = true + if (dirs.size != 0 && !mLoadedInitialPhotos) { gotDirectories(dirs) } + if (!mLoadedInitialPhotos) { + directories_refresh_layout.isRefreshing = true + } + mLoadedInitialPhotos = true mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { gotDirectories(it) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index d9bfd91e0..7591a2e91 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -220,13 +220,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mIsGettingMedia = true val token = object : TypeToken>() {}.type val media = Gson().fromJson>(config.loadFolderMedia(mPath), token) ?: ArrayList(1) - if (media.size == 0) { - media_refresh_layout.isRefreshing = true - } else if (!mLoadedInitialPhotos) { - mLoadedInitialPhotos = true + if (media.size == 0 && !mLoadedInitialPhotos) { gotMedia(media) } + if (!mLoadedInitialPhotos) { + media_refresh_layout.isRefreshing = true + } + mLoadedInitialPhotos = true mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) { gotMedia(it)