From 0ab0edd78a3a5897d62f0d110467ae06e87f1021 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 30 Nov 2016 23:22:10 +0100 Subject: [PATCH] always try the simple way of deleting files too, like from internal storage --- .../simplemobiletools/gallery/activities/MainActivity.kt | 7 +++++++ .../simplemobiletools/gallery/activities/MediaActivity.kt | 7 +++++++ .../gallery/activities/ViewPagerActivity.kt | 8 ++++++++ 3 files changed, 22 insertions(+) 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 3ed48516d..5ef151d91 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -208,6 +208,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } else { file.delete() } + + if (file.exists()) { + try { + file.delete() + } catch (ignored: Exception) { + } + } } private val undoDeletion = View.OnClickListener { 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 412c05aec..2c6437264 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -228,6 +228,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (file.delete()) wereFilesDeleted = true } + + if (file.exists()) { + try { + file.delete() + } catch (ignored: Exception) { + } + } } } 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 0ebe28067..e29352681 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -295,6 +295,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View mWasFileDeleted = file.delete() } + if (!mWasFileDeleted) { + try { + mWasFileDeleted = file.delete() + } catch (ignored: Exception) { + + } + } + if (mWasFileDeleted) { mBeingDeleted = mToBeDeleted scanPath(mToBeDeleted) { scanCompleted() }