show the refreshing icon at opening the gallery

This commit is contained in:
tibbi 2017-04-17 17:59:05 +02:00
parent dab8442119
commit 8849db924e
2 changed files with 10 additions and 8 deletions

View File

@ -160,13 +160,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mIsGettingDirs = true mIsGettingDirs = true
val token = object : TypeToken<List<Directory>>() {}.type val token = object : TypeToken<List<Directory>>() {}.type
val dirs = Gson().fromJson<ArrayList<Directory>>(config.directories, token) ?: ArrayList<Directory>(1) val dirs = Gson().fromJson<ArrayList<Directory>>(config.directories, token) ?: ArrayList<Directory>(1)
if (dirs.size == 0) { if (dirs.size != 0 && !mLoadedInitialPhotos) {
directories_refresh_layout.isRefreshing = true
} else if (!mLoadedInitialPhotos) {
mLoadedInitialPhotos = true
gotDirectories(dirs) gotDirectories(dirs)
} }
if (!mLoadedInitialPhotos) {
directories_refresh_layout.isRefreshing = true
}
mLoadedInitialPhotos = true mLoadedInitialPhotos = true
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
gotDirectories(it) gotDirectories(it)

View File

@ -220,13 +220,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mIsGettingMedia = true mIsGettingMedia = true
val token = object : TypeToken<List<Medium>>() {}.type val token = object : TypeToken<List<Medium>>() {}.type
val media = Gson().fromJson<ArrayList<Medium>>(config.loadFolderMedia(mPath), token) ?: ArrayList<Medium>(1) val media = Gson().fromJson<ArrayList<Medium>>(config.loadFolderMedia(mPath), token) ?: ArrayList<Medium>(1)
if (media.size == 0) { if (media.size == 0 && !mLoadedInitialPhotos) {
media_refresh_layout.isRefreshing = true
} else if (!mLoadedInitialPhotos) {
mLoadedInitialPhotos = true
gotMedia(media) gotMedia(media)
} }
if (!mLoadedInitialPhotos) {
media_refresh_layout.isRefreshing = true
}
mLoadedInitialPhotos = true mLoadedInitialPhotos = true
mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) { mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) {
gotMedia(it) gotMedia(it)