show the swipeRefreshLayout spinner at loading images after filtering change

This commit is contained in:
tibbi 2017-08-28 23:12:07 +02:00
parent 141953338e
commit ab35c970b9
2 changed files with 6 additions and 4 deletions

View file

@ -183,7 +183,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mIsGettingDirs = true mIsGettingDirs = true
val dirs = getCachedDirectories() val dirs = getCachedDirectories()
if (dirs.isNotEmpty() && !mLoadedInitialPhotos) { if (dirs.isNotEmpty() && !mLoadedInitialPhotos) {
gotDirectories(dirs) gotDirectories(dirs, true)
} }
if (!mLoadedInitialPhotos) { if (!mLoadedInitialPhotos) {
@ -205,6 +205,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private fun showFilterMediaDialog() { private fun showFilterMediaDialog() {
FilterMediaDialog(this) { FilterMediaDialog(this) {
directories_refresh_layout.isRefreshing = true
getDirectories() getDirectories()
} }
} }
@ -389,7 +390,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
} }
private fun gotDirectories(dirs: ArrayList<Directory>) { private fun gotDirectories(dirs: ArrayList<Directory>, isFromCache: Boolean = false) {
mLastMediaModified = getLastMediaModified() mLastMediaModified = getLastMediaModified()
directories_refresh_layout.isRefreshing = false directories_refresh_layout.isRefreshing = false
mIsGettingDirs = false mIsGettingDirs = false

View file

@ -237,6 +237,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun showFilterMediaDialog() { private fun showFilterMediaDialog() {
FilterMediaDialog(this) { FilterMediaDialog(this) {
media_refresh_layout.isRefreshing = true
getMedia() getMedia()
} }
} }
@ -304,7 +305,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
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.isNotEmpty() && !mLoadedInitialPhotos) { if (media.isNotEmpty() && !mLoadedInitialPhotos) {
gotMedia(media) gotMedia(media, true)
} else { } else {
media_refresh_layout.isRefreshing = true media_refresh_layout.isRefreshing = true
} }
@ -453,7 +454,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
} }
} }
private fun gotMedia(media: ArrayList<Medium>) { private fun gotMedia(media: ArrayList<Medium>, isFromCache: Boolean = false) {
mLastMediaModified = getLastMediaModified() mLastMediaModified = getLastMediaModified()
mIsGettingMedia = false mIsGettingMedia = false
media_refresh_layout.isRefreshing = false media_refresh_layout.isRefreshing = false