From c2ea3ad4bb97e4ce9d8bc3218053631714b88814 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 4 Oct 2017 18:53:45 +0200 Subject: [PATCH] stop media fetching on pause only if its not our first time there --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 ++++- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 881e50c9f..4c1ce7725 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -166,7 +166,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredTextColor = config.textColor directories_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) - mCurrAsyncTask?.stopFetching() + + if (!mDirs.isEmpty()) { + mCurrAsyncTask?.stopFetching() + } } override fun onDestroy() { 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 4851c7305..760d1e90a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -125,7 +125,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mStoredTextColor = config.textColor media_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) - mCurrAsyncTask?.stopFetching() + + if (!mMedia.isEmpty()) { + mCurrAsyncTask?.stopFetching() + } } override fun onDestroy() {