From 2f152da15a79c0dff367ab642d6345991eb773cc Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Jul 2018 20:51:17 +0200 Subject: [PATCH] start the media fetching asynctask only after cached files have been loaded --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) 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 f7816899d..847db89c2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -543,12 +543,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } else { gotMedia(it, true) } + startAsyncTask() } } else { media_refresh_layout.isRefreshing = true + startAsyncTask() } mLoadedInitialPhotos = true + } + + private fun startAsyncTask() { mCurrAsyncTask?.stopFetching() mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetImageIntent, mIsGetVideoIntent, mShowAll) { Thread {