From 7f17aeda71ff7476e4c5bcb378be6634d8489654 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 22 Apr 2018 10:39:00 +0200 Subject: [PATCH] refresh media thumbnails instantly after changing sorting or filtering --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 7d167f334..498a25994 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -274,7 +274,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val filtered = mMedia.filter { it.name.contains(text, true) } as ArrayList filtered.sortBy { !it.name.startsWith(text, true) } runOnUiThread { - (media_grid.adapter as? MediaAdapter)?.updateMedia(filtered) + getMediaAdapter()?.updateMedia(filtered) } }.start() } @@ -367,12 +367,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun showSortingDialog() { ChangeSortingDialog(this, false, !config.showAll, mPath) { + mLoadedInitialPhotos = false getMedia() } } private fun showFilterMediaDialog() { FilterMediaDialog(this) { + mLoadedInitialPhotos = false media_refresh_layout.isRefreshing = true getMedia() } @@ -380,8 +382,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun toggleFilenameVisibility() { config.displayFileNames = !config.displayFileNames - if (media_grid.adapter != null) - getMediaAdapter()?.updateDisplayFilenames(config.displayFileNames) + getMediaAdapter()?.updateDisplayFilenames(config.displayFileNames) } private fun switchToFolderView() {