From 7e73d979a1894dcf8142a1195cef1c245ebe4898 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 15 May 2019 09:12:47 +0200 Subject: [PATCH] speed up video moving in the recycle bin from fullscreen view --- .../gallery/pro/activities/ViewPagerActivity.kt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 6cd8e97a4..f698a21c9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -909,25 +909,34 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val fileDirItem = FileDirItem(path, path.getFilenameFromPath()) if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { + mIgnoredPaths.add(fileDirItem.path) + val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList + runOnUiThread { + gotMedia(media) + } + movePathsInRecycleBin(arrayListOf(path)) { if (it) { - handleDeletion(fileDirItem, false) + tryDeleteFileDirItem(fileDirItem, false, false) { + mIgnoredPaths.remove(fileDirItem.path) + } } else { toast(R.string.unknown_error_occurred) } } } else { - handleDeletion(fileDirItem, true) + handleDeletion(fileDirItem) } } - private fun handleDeletion(fileDirItem: FileDirItem, deleteFromDatabase: Boolean) { + private fun handleDeletion(fileDirItem: FileDirItem) { mIgnoredPaths.add(fileDirItem.path) val media = mMediaFiles.filter { !mIgnoredPaths.contains(it.path) } as ArrayList runOnUiThread { gotMedia(media) } - tryDeleteFileDirItem(fileDirItem, false, deleteFromDatabase) { + + tryDeleteFileDirItem(fileDirItem, false, true) { mIgnoredPaths.remove(fileDirItem.path) } }