From 8849db924e4afba4afd9c3d36795601bff90a0d2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 17 Apr 2017 17:59:05 +0200 Subject: [PATCH] show the refreshing icon at opening the gallery --- .../simplemobiletools/gallery/activities/MainActivity.kt | 9 +++++---- .../gallery/activities/MediaActivity.kt | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) 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)