From 42faaf51c11d3d99ceb489c206cebbbf44bc24a4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 12:13:49 +0100 Subject: [PATCH] delete file from mediastore on ViewPagerActivity in the background --- .../gallery/activities/ViewPagerActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index f9a813d6d..64b5e02e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -181,8 +181,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } val file = File(mPath) - if (!file.exists()) { - deleteFromMediaStore(file) + if (!file.exists() && file.length() == 0L) { + Thread { + deleteFromMediaStore(file) + }.start() finish() return }