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
val token = object : TypeToken<List<Directory>>() {}.type
val dirs = Gson().fromJson<ArrayList<Directory>>(config.directories, token) ?: ArrayList<Directory>(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)

View File

@ -220,13 +220,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mIsGettingMedia = true
val token = object : TypeToken<List<Medium>>() {}.type
val media = Gson().fromJson<ArrayList<Medium>>(config.loadFolderMedia(mPath), token) ?: ArrayList<Medium>(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)